Friday, May 18, 2012

How to write a generic extension for ObjectSet<T> that works with entity types having common property names.

Sometimes you have the same properties in multiple entities.

It is possible to end up duplicating the same logic in the manner of the dreaded copy-modify monster.  I have learned to take it seriously when I find myself doing this because it has never not eventually come back to haunt me .

The key to making this work is to first deploy a couple of simple extension methods to make reflection a bit easier.

Then it is less daunting of a task to write a generic routine that acts on any entity set with common propertie(s).

No comments:

Post a Comment