I would like to be able to use Entity Framework with a repository pattern for non-spatial querying of my SDE Sql Server database. I was hoping to reverse code-first engineer the database with the Entity Framework Power Tools to accomplish this.
Has anyone tried this before or something similar? Is it feasible?
A couple issues I've come up with:
- The reverse engineering tool doesn't know what to do with the geometry data type in the database, so it skips those columns when generating the POCOs. I'm hoping to get around this by referencing Microsoft.SqlServer.Types.dll (or whatever assembly) and adding a geometry property to my POCOs.
- Converting my POCO into an IFeature if I want to do some spatial stuff with it. I'm not sure how I'd set the feature's geometry.
- How to handle adding and updating in my EF context. I'd probably make it "read only" so that clients can retrieve data but not commit to it. I have no idea how to handle the versioning, even if it were possible to commit a feature back to the database purely with EF.