Computed Columns Using LINQ to SQL Classes

Last week we looked at the extension points Microsoft has wired into the LINQ to SQL classes and how they can be used to achieve some of the capabilities of the Business Logic Layer (BLL) in a multi-layered architecture.

We saw that this feature allowed us to modify data as it was coming out of the database up to the presentation layer and from the presentation layer down to the database.  But, what about the times when what you really want is another field in your row that is based on the other fields in your database?

You actually have two choices.  You could create a SQL statement that computes the columns for you.  Or you can add a property to your LINQ to SQL classes that computes the value for you.

Related Post

Leave a Reply

Comment Policy:

  • You must verify your comment by responding to the automated email that is sent to your email address. Unverified comments will never show.Leave a good comment that adds to the conversation and I'll leave your link in.
  • Leave me pure spam and I'll delete it.
  • Leave a general comment and I'll remove the link but keep the comment.

Notify me of followup comments via e-mail

Bear