質問

I'm testing the new ApiController in asp.net mvc 4 beta but when I try to return an class that looks like the following only a few properties gets serialized?

public class PageModel : IPageModel {
    public string Id { get; set; }
    public virtual IPageMetadata Metadata { get; private set; }
    public PageModel() {
        Metadata = new PageMetadata();
    }
}

this is the code in my api controller

    // GET /api/pages/5
    public PageModel Get(string id) {
        return new PageModel { Id = "pages/1", Metadata = {Name = "Foo"} };
    }

and this is the result

{
Id: "pages/1",
Parent: null
}

Is it possible to get the complete object and not only a few things?

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top