开发者

complex type in entity framework

When I need to use the complex type in entity framework?? or in other words what is the complex ty开发者_JAVA技巧pe used for ?

Thanks


In EF4, it's used mostly for returned values from stored procedures that don't match exactly onto an existing entity in your model. See Julie Lerman's blog post A big step for Stored Procedures in EF4 on this topic.

If you have a stored proc that returns e.g. a CustomerID, CustomerName and the total sales for that customer for last year, and you don't have any entity that matches these three fields, you can easily create a new complex type in the entity model "on the fly" to capture those value sets returned from your stored proc.

That's probably the most useful and most common usage of complex types, as far as I can tell.

For more on EF4 complex types, see Julie Lerman's blog post: Complex Types in the EDM Designer in EF4 and a look at updating complex types in code

UPDATE: there's a new interesting blog post by the EF4 team on how to "sniff stored procedure return types" and how to use automatic complex types for those return types.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜