All the power at your disposal
I invite you to take a look at this forum post from 'Benys'
It illustrates the power of the Entity Framework's mapping capabilities + partial classes.
The short answer to a lot of "Does the EF support ... ?" type questions is often no.
Often however the longer answer, is a little easier to digest.
If you start using the power of DefiningQueries / Partial Classes / View / Stored Procs suddenly lots of things become possible.
The nice thing about 'Benys' example is that while UDTs ( spatial types are basically UDTs ) are not natively supported by the Entity Framework, there is a nice work around...
Here is the pattern:
- Define your Entity with Binary properties rather than UDT properties
- Create a DefiningQuery in your SSDL that uses T-SQL to convert from the UDT to binary.
- In the partial class add a property that goes from binary back to you UDT in memory.
The are a few caveats of course*, but this is just the sort of work-around that allows you to handle an issue that might otherwise be a real show-stopper.
* Issues (non exhaustive list)
- The property you define in your partial class can't be used in a query
- You can't make use of a UDT's operations in a query
- The extra step of materializing twice (the Binary + the UDT) makes it a little slower
- You have to keep your partial class properties and the entity properties in sync
Comments
- Anonymous
February 25, 2008
Dans un précédent post , j'avais signalé, via la réponse de Daniel Simmons , que les UDT n'étaient pas - Anonymous
March 02, 2008
Also if you want to modify objects, you have to define insert/update/delete store procedures for type and some navigation properties :( - Anonymous
October 14, 2008
This one has come up a few times. LINQ to SQL and LINQ to Entities in V1 do not currently support the