How to Implement Database Independence with Entity Framework

前端 未结 2 767
盖世英雄少女心
盖世英雄少女心 2021-02-06 06:05

I have used the Entity Framework to start a fairly simple sample project. In the project, I have created a new Entity Data Model from a SQL Server 2000 database. I am able to qu

相关标签:
2条回答
  • 2021-02-06 06:25

    http://blogs.msdn.com/jkowalski/archive/2008/09/09/persistence-ignorance-poco-adapter-for-entity-framework-v1.aspx

    The main problem is that the entity framework was not designed with persistence ignorance in mind. I would honestly look at using something other than entity framework.

    0 讨论(0)
  • 2021-02-06 06:42

    What is generally understood under the term "Persistence Ignorance" is that your entity classes are not being flooded with framework dependencies (important for N-tier scenarios). This is not the case right now, as entity classes must implement certain EF interfaces ("IPOCO"), as opposed to plain old CLR objects. As another poster has mentioned, there is a solution called Persistence Ignorance (POCO) Adapter for Entity Framework V1 for that, and EF V2 will support POCO out of the box.

    But I think what you really had in mind was database independence. With one big configuration XML that includes storage model, conceptual model and the mapping between those two from which a typed ObjectContext will be generated at designtime, I also find it hard to image how to transparently support two databases.

    What probably looks more promising is applying a database-independent ADO.NET provider like the one from DataDirect. DataDirect has also announced EF support for Q3/2008.

    0 讨论(0)
提交回复
热议问题