EntityFrameworkCore.Projectables icon indicating copy to clipboard operation
EntityFrameworkCore.Projectables copied to clipboard

Auto-configure projectable properties as [NotMapped]

Open Bretttt opened this issue 1 year ago • 0 comments

All IEnumerable<> projectable properties have to be marked as [NotMapped] or EF throws an error. Example:

[Projectable]
public IEnumerable<MyThings> MySpecialThings => MyThings.Where(t => t.IsSpecial);

EF appears to be trying to map all properties defined as IEnumerable<> or ICollection<> as navigation properties, even if they are get-only (which, needless to say, includes properties like the above).

I could be convinced otherwise, but I would make the case that all projectable properties will always be unmapped.

It would be nice to have this library iterate through the models as part of model building and call .Ignore(theProjectableProperty)

Bretttt avatar Jun 20 '24 20:06 Bretttt