to-do list sample正在使用BreezeController来提供API。 EFContextProvider
用于提供Metadata
字符串和方法,如SaveChanges()
。我必须使用BreezeController吗?
问题:它直接与DbContext
对话。我仍然希望能够灵活地返回我自己的视图模型,而不是那些领域模型。
在常规的ApiController
中,我们可以轻松地返回自己的视图模型。但是,如果我转向定期ApiController
,调用API时,breeze
询问Metadata
,这是由
[HttpGet]
public string Metadata() {
return _contextProvider.Metadata();
}
如果我们使用BreezeController
提供。
所以,我的问题是,我们必须使用BreezeController
?我们如何使用它返回自定义视图模型?或者,如果我们使用常规的ApiController
以获得更大的灵活性,我们如何提供Metadata
?