[英]EF 5.0 - Generated POCO's contain System.Data.Spatial.DbGeography type
I have two c# projects, one containing the edmx file (db first approach) and a second one (POCO-Project) to where the POCO's (DAO's) are generated. 我有两个c#项目,一个包含edmx文件(db第一种方法),第二个包含POCO项目(DAO)的第二个项目(POCO-Project)。 I want to use the classes of the poco project in the UI and Business Layer. 我想在UI和业务层中使用poco项目的类。
My problem is, that some of the generated POCO's contain properties of type 我的问题是,某些生成的POCO包含类型为
System.Data.Spatial.DbGeography System.Data.Spatial.DbGeography
And I don't want the POCO project to be tight to System.Data.dll. 而且我不希望POCO项目与System.Data.dll紧密相关。 Can I tell EF to generate an System.Data independent object for 我可以告诉EF为之生成System.Data独立对象吗
System.Data.Spatial.DbGeography System.Data.Spatial.DbGeography
Or what would be a viable work around? 还是可行的解决方案? I don't want to force other projects to add a reference to System.Data.dll 我不想强迫其他项目添加对System.Data.dll的引用
Based on your needs I would consider implementing a DTO(basically another POCO) for DbGeography where you can hold all the data stored within System.Data.Spatial.DbGeography. 根据您的需求,我会考虑为DbGeography实现DTO(基本上是另一个POCO),在其中您可以保存System.Data.Spatial.DbGeography中存储的所有数据。 That way you keep all the data without the reference to System.Data. 这样,您无需参考System.Data就可以保留所有数据。 But this comes at a price, you'll have to make sure the data is correctly tranfered from the actual DbGeography to your DTO and you'll lose all the methods of DbGeography. 但这是有代价的,您必须确保将数据从实际的DbGeography正确传输到您的DTO,并且您将丢失所有DbGeography的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.