> I'm just messign about with linq at the moment. > > I was wondering if there is a standard way to map between linq structures. > > i.e. I have a normalised database schema created in the designer, I don't > want to bind to this directly but obviously to some slightly denormalisied > version of it.
I don't see the 'obvious' part in that remark. For FETCHING, it might be handy to have denormalized data in some areas, but for saving entities, you definitely want to stick to the abstract entity definitions in your program's reality, not some denormalized pile of tables. The abstract definition of, say, 'Customer', is fixed. You therefore want to work with such an entity in your code, as otherwise referring to 'Customer' inside your code is meaningless: it doesn't mean anything, as the abstract definition of 'Customer' is something else in that case. A class and a table are physical representations of that same abstract definition, hence it's possible to create a mapping at all. Denormalization for performance purposes therefore isn't useful for entities. It's only useful for new sets, derived from the entity instances, e.g. all orderid's with the customer's companyname joined to it. > I can create a denormalised version in the linq sql > designer, and not bind it to a database, but it is inherently based on > DataContext, which appears to be the SQL 'driver'. Denormalized data has no real advantage unless it's stored denormalized. Otherwise you're joining the crap out of your db at runtime ;). So take a look at indexed views. These are stored as-is and therefore do offer performance optimizations. You then should be able to map an entity onto such a view. Just for fetching of course, Saving data should be done with normal entities. FB =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com