开发者

Using Entity Framework with poco by model first

HI,

I'm a bit lost with Entity Framework ...

Here is the context : Desktop Application (C# / Winform) VS 2010 (SP1), SQL COMPACT (4.0 for identity), ... for now EF 4 (default version)

I've just started a new app and i've thinking of using EF because it seems that it's a qu开发者_JS百科ickest way to design both model and database (i know that it's not the best way but my project is not critical).

building the model with graphic designer is very convenient, i can easyly build the sql compact schema' and i can access model class directly.

But i need to add some feature to my model class (overriding ToString for example or some basics functions), so it seem that i need to make POCO classes.

But the problem is after generating these classes, how can i update these without losing added code , what's the best way to doing that ? partial class ?

Moreover, it seem that EF dev are focusing on Code First, so does it mean that Entity Model are already deprecated ?


EF generates partial classes, so you are right - in order not to lose the extra code you add, you need to create separate files and use the partial class feature. Those files won't be re-written once the model is saved.

Moreover, it seem that EF dev are focusing on Code First, so does it mean that Entity Model are already deprecated ?

No, it's not deprecated. Using Code First is just a matter of preference, but you can feel free to use the EDM - it's not going anywhere.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜