Let's say I have a Person table with a FirstName and LastName column. I extended the Person LINQ entity class with a get property "FullName", that concatenates the first and last names.
A LINQ query like:
from person...
select fullName
where id = x
This is a simple example, but the limitation it shows is that I cannot isolate my business/formatting rules but have to embed them in the LINQ query, so they're not reusable (since it is in the select part) or I need select both columns separately, and then concatenate them higher up in the data or business layer with static helper methods.
Any ideas for a clean design using the entity partial classes or extensions?
Thanks
Personally, I'd create a computed column at the table level so it's part of the entity you store in a row
精彩评论