Self-tracking entities not recommended anymore. What is?
Asked Answered
C

1

5

Reading the msdn information on EF 5.0 and n-tier solutions see link , it seems that MS is not recommending STE's and the POCO/DTO way is also not recommended by stating that it is difficult.

Not all (perhaps not many?) applications are suited for using WCF Data Services. So what is the way to go? My scenario is a current, large server (WebServices) application with many clients (only our own), mostly WinForms. Today DataSets are used to ship the data and track changes into the SQL Server database.

We are now starting to replace WebServices with WCF and are also looking into using the Entity Framework. We don't need code first or migrations since we already have the database in place and a lot of stored procedures that will be reused. Since we don't have any issues with clients being other than our own, STE's seemed like a good choice, but we don't want to start using something that the EF team is clearly not recommending anymore. POCO/DTO has also been an alternative, not least for the clear separation against the clients. I know there is more work to be done then with the CUD, but is it so difficult that the recommendation is to stay away, then I don't know if we want to go down that road.

Then, according to the recommendation we should use WCF data services or Web API, but that is really not an alternative for a operation-based service that needs to be flexible about protocol/format etc.

So my question is, what is best-practice today?

Centrist answered 17/9, 2012 at 9:55 Comment(4)
best practice? If it ain't broke, don't fix it!Pulliam
Im very curious as to why this is as STEs give a hefty performance boost in some (but not all) situationsBrendis
Wouldn't this question be better placed on programmers.stackexchange.com?Dextrosinistral
bizarre - if they don't recommend STEs, what do they recommend? In the link you supply, they also recommend against NTier with EF directly! I have had great success with RIA services but that is really Silverlight only (although I believe that there is an ASP .NET story for that now?). It works like a charm.Upandcoming
S
3

I think the idea is to move more generally to lighter weight pocos/dtos and keeping any an all persistence logic or implementation in your DAL. Self tracking entities sort of bleed some of that implementation out and fatten up your entities. You gain convenience, but loose flexibility as dumb dto's can be passed around easily with few suprises.

Of course the flip side to that is you need to do more work in your dal to track context and you need to do more work in your BLL and UI to deal with populating/mapping dto's.

I personally prefer flexibility over convenience and that seems to be the way things are going in general.

Stamper answered 5/10, 2012 at 15:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.