1

Need to disable auto mapping feature of EF7, wanna manage the mapping by code-first alone, no convention and auto-detection.

Given I have a class with 5 props that need to be saved and other 2 props to manage changes special way, I don't wanna to touch mapping code each time, when I introduce a new property into that class. I'm fine with if I need to do all the mapping with fluent API manually.

Before someone mentions [NotMapped] or Ignore() - no, this is not a solution, just a bypass (hack). I wanna have a clean mapping file, without mentioning properties inside that I don't intend to map.

Similar question, less verbose described: How to disable automapping of properties in Entity Framework

Community
  • 1
  • 1
baHI
  • 1,510
  • 15
  • 20
  • Already tried: public interface IEntityTypeConfiguration where TEntity : class { void Map(EntityTypeBuilder builder); } But this is not working, since if there was a IList mapped for a Student entity, then also the Course entity got mapped... And removing entities (which we already might have mapped) is not recommended. Btw: the MAP should be idempotent, I think... – baHI Feb 15 '17 at 13:52
  • It seems that I might have had some extra code that produced that mapping. Need to re-check this. Anyhow I have found a show-stopper for EF7. No, it's not the lac of missing lazy-loading, but the lack of not having an exception when accessing a non-loaded object. I got empty collections or null values, which just lead to confusion when used in code... – baHI Feb 16 '17 at 08:18
  • See https://github.com/aspnet/EntityFramework/issues/1414 – Smit Feb 17 '17 at 00:14

0 Answers0