Does anyone know of any libraries which implement an abstraction in LINQ over the Entity Attribute Value (EAV) pattern? I have a large legacy EAV database and I'm trying to create a cleaner data access layer and the thought of using LINQ really appeals so开发者_如何学Go I'm looking for any code I can use to jumpstart.
Having been involved in several LINQ providers, I can say there's no LINQ abstractions for EAV that I'm aware of. I think you're SOL.
I know you said you've inherited an existing EAV database, but if you have an option to use something else, perhaps this post will sway you away from EAV. :-)
With .NET 4 and dynamic objects, it's not that hard to represent EAV as DynamicObject and then to handle the data access between the "fields" and the appropriate rows. Translating full LINQ queries over EAV is more difficult.
That being said, many cases that really need EAV can often be achieved through SQL Sparse columns, XML data types, or NoSql document database alternatives. The difficulty in building LINQ providers against some of these alternatives is non-trivial as seen in the efforts to create LINQ for MongoDb and RhinoDB.
精彩评论