Monday, June 5, 2017

I am getting used to the .edmx Entity Framework IQueryable incompatibility with partial extensions of generated code.

Oldest C# trick in the book: I have a POCO (plain old CLR object) named Person and Person has getsetters for FirstName and LastName. I also make a convenience method for FullName which basically concatenates the two with a space between them. Well, I guess that is not the very oldest trick. !Page.IsPostBack probably beats that. Anyhow, in the Entity Framework means there would be a generated partial class for Person with the FirstName and the LastName and you could extend it by making a partial class with your own malarkey like a FullName method... you just can't use Full name in an IQueryable.

No comments:

Post a Comment