我们需要一个ORM/,该工具将允许我们在MSSQL数据库中以“数据库优先”的方式生成多个项目/程序集中的多个相关领域模型。我们需要一些帮助,找出哪些工具能满足我们的需要。
所需经费如下:
- Our domain is split into numerous modules and for each client (whom we give source code to) we don't use all modules and so we'd like to "unplug" all the logic they don't need to see or get access to.
- For example, we want to store a shared data (mostly common lookup information) in it's own common assembly.
- We don't need two-way relationships between models (because that would cause a circular reference). Only the child end of relationship would get generated.
- Similar to above, we want to be able to abstract common functionality into base classes in one domain model and inherit them.
- Note: Inheritance links between domains will be limited, only one or two per sub-domain.
- Note: It shouldn't matter, but we are using "Table per Type" or "[Class Table Inheritance](http://martinfowler.com/eaaCatalog/classTableInheritance.html)" to model our inheritance in our relational (DB) schema
1. Marked with DataContract/DataMember attributes
2. Notify of property changes (via INotifyPropertyChanged implementations)
3. Have partial On\*PropertyName\*Changed() methods (e.g. as per Linq to SQL and Entity Framework generated objects)
4. (Ideal, but not necessary) Related collection types should implement INotifyCollectionChanged.
对于任何支持这些标准的ORM工具(或有支持的解决方案)的任何反馈,我们将不胜感激!
注意:我们已经看过的工具(但这并不完全排除它们):
AsSeparateProjects模式进行分组时,它似乎不支持跨模型关系,更不用说继承)。发布于 2011-03-08 07:48:16
这肯定需要一个小的概念证明项目,因为你的需求并不是在有关EF的论文中通常描述的。
对于1和2,请阅读这些文章(第1部分、第2部分),并尝试提供简单的解决方案,这将证明您能够在多个EDMX之间使用关系和继承。
最后一点将由自定义T4模板来满足,这些模板用于从EDMX生成类--从POCO模板开始并修改其生成特性。
发布于 2011-03-08 19:58:47
虽然这听起来可能与你要求的相反,但我可能会看看EF码第一。因为它都是构建在POCOs、DbSets和一个DbContext类之上的,所以您将能够很容易地获得继承。
共享模型和公共程序集中的抽象DbContext。在客户特定的程序集中拥有特定的模型和最终的DbContext。
在WinForms前线,有关于如何使这些场景可以被观察到的这里的示例代码。您需要自己来处理INotifyPropertyChanged,但这很容易。
首先,EF代码的缺点是没有办法只生成所有的类。话虽如此,但它们很简单,我很可能会在编写应用程序其余部分的时候,根据需要编写它们。任何形式的通用自动化工具都很难确定哪些模型和属性属于共同的和特定于客户的。
https://stackoverflow.com/questions/5227721
复制相似问题