Legends
Legends

Reputation: 22702

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

Upvotes: 0

Views: 153

Answers (1)

Gustavo
Gustavo

Reputation: 531

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.

Upvotes: 1

Related Questions