louthy/language-ext

Lenses and EF Core incompatibility

kasozivincent opened this issue · 1 comments

Hi, everyone. I am working on a project where I am using DDD. I am trying to embrace immutability of my entity classes by using Lenses. The problem is that for a class to use lenses, it must exopose readonly fields where EF Core can only persist classes with props with getters and private setters.

Does anyone know of a work around about this? Thank you.

louthy commented

This is an issue for EF, not for here. If you're talking about the CodeGen generated lenses in the record-types: they're static, so I'm not sure why they would be serialised in EF. If you're talking about manually written lenses, consider using static lens fields or adding the [NotMapped] attribute.

Again you've not provided any details for me to go on, so this is all I can say for now.