Last post Mar 05, 2012 10:44 AM by ColinBlair
Mar 02, 2012 05:21 PM|netletnet|LINK
web-api/spa is looking great. I'm wondering what the best direction is for me. I want to expose view models via the end points, not EF models, but i like the format of the odata v2 for client side paging (determining number of pages, total count in the
Can i use Http.Data.DataController instead of EntityFramework.DbDataController<T> ? with upshot and knockout?
My guess is that I can use a datacontroller, but I dont know how to manage the changeset.
If this doesn't work, i think i need to use Web.Http.ApiController with knockout and wire up my own.
Thanks in advance.
Mar 03, 2012 02:13 AM|thaicarrot|LINK
For me, I would like to balance Server and Client. You can do that but you should fogoes Upshort. I am not sure Upshort is best or bad at this time.
I would like to use regular controller rather than new API because those controller can manipulate HTML and data so that I would put some complicate lagic into the server.
Why they did not integrated new API into those existing Controller?
Mar 05, 2012 10:44 AM|ColinBlair|LINK
Yes, you can use the base DataController. In general, if you look for guides on WCF RIA Services and the DomainService many of the same concepts will apply to the DataController. In general, in your CUD methods (Create, Update, Delete) what you want to do
is store the individual changes (if you are using a repository, you can store the changes there). Then you need to override the PersistChangeset method of the DataController. When PersistChangeset is called that is where you want to update your database.
BTW, I don't use the term "view models" in relation to SPA because the term conflicts with the ViewModels in MVVM. In Silverlight/RIA Services we called them either presentation models or just plain POCOs, I am not sure how that is going to translate into
ASP.NET terminology yet.