I\'ve decided to use fluent mapping in Entity Framework. My intention was to map everyting by code without any atributes and auto mapping functions. Best way I\'ve found is clas
Actually I have tried a lot of ways: - custom convention to remove mapped properties - removing all conventions
But the easiest (and cleanest) way was to use reflection inside the mapping class and to disable all property mappings that weren't configured.
The code for that (and also an usage example) is inside my public gist. https://gist.github.com/hidegh/36d92380c720804dee043fde8a863ecb
So far as I am aware, there is no other way around it. You need to use either Ignore()
or [NotMapped]
. I tend to prefer the former as it does not clutter up the model.