I am looking to create Extension classes that extend Entity Framework Entities in a different assembly to the EF Entities. I also want to code gen some additional/generic methods in an extension methods class (using T4), then have the ability to create a partial extension methods class with additional custom methods. Is this possible.
I am looking to create Extension classes that extend Entity Framework Entities in a
Share
You don’t need them. Just write another extension class.
Then, elsewhere…
Anything importing
Namespace1will see the extension methodBlibble()while anything importingNamespace2will seeFurtle(), and importing both will see both. They can be in different assemblies or anywhere which importsMyEntity‘s namespace. So, partial extensions aren’t really a valid concept. In fact, the very idea of putting extension methods inside classes is a bit of a hack as it is – a shame they couldn’t unbend C#’s rules enough to let extension methods live outside of classes.