简体   繁体   中英

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. I want to use the classes of the poco project in the UI and Business Layer.

My problem is, that some of the generated POCO's contain properties of type

System.Data.Spatial.DbGeography

And I don't want the POCO project to be tight to System.Data.dll. Can I tell EF to generate an System.Data independent object for

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

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. That way you keep all the data without the reference to 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM