0

I have an extremely odd error and wondered if anyone knew the reason for this.

When I create a new DataObject and TableController called Content and ContentController respectively, it doesn't register the tablecontroller and the help documentation it automatically generates has lost its styling.

I can't connect to the controller at all but all other controllers work as expected.

If I just rename it to DataController and that's just the name of the controller, not the dataobject everything works perfectly.

Is ContentController a reserved word of some kind or is this just specifically happening on my machine?

public class DataController : TableController<Content>
{
    protected override void Initialize(HttpControllerContext controllerContext)
    {
        base.Initialize(controllerContext);
        MobileContext context = new MobileContext();
        DomainManager = new EntityDomainManager<Content>(context, Request, Services);
    }

    // GET tables/Content
    public IQueryable<Content> GetAllContent()
    {
        return Query(); 
    }

    // GET tables/Content/48D68C86-6EA6-4C25-AA33-223FC9A27959
    public SingleResult<Content> GetContent(string id)
    {
        return Lookup(id);
    }

    // PATCH tables/Content/48D68C86-6EA6-4C25-AA33-223FC9A27959
    public Task<Content> PatchContent(string id, Delta<Content> patch)
    {
         return UpdateAsync(id, patch);
    }

    // POST tables/Content/48D68C86-6EA6-4C25-AA33-223FC9A27959
    public async Task<IHttpActionResult> PostContent(Content item)
    {
        Content current = await InsertAsync(item);
        return CreatedAtRoute("Tables", new { id = current.Id }, current);
    }

    // DELETE tables/Content/48D68C86-6EA6-4C25-AA33-223FC9A27959
    public Task DeleteContent(string id)
    {
         return DeleteAsync(id);
    }

}
Adam
  • 16,089
  • 6
  • 66
  • 109
  • What is the error that you get when the controller is named ContentController? How do you generate the help document and what kind of mess up happens when the controller is named as ContentController? – Nalashaa Sep 09 '14 at 06:27
  • There is no error generated as such. When I run the project and I go to http://localhost/help, the styling for that page is all gone. So its all standard font and left aligned. – Adam Sep 09 '14 at 07:07
  • And I can't connect to the controller at all. I get a 404 error when trying to do localhost/tables/Content/{guid}. However all other controllers work well. – Adam Sep 09 '14 at 07:07

1 Answers1

3

An MVC project will create an application directory called Content. This will override your route mapping to the ContentController.

You can get around this if desired through changing RouteMaps and other trickery although probably the simpliest answer is to change the name of the controller...

Community
  • 1
  • 1
SeanCocteau
  • 1,838
  • 19
  • 25