How to disable automapping of properties in Entity Framework

前端 未结 2 991
太阳男子
太阳男子 2021-01-21 11:10

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

2条回答
  •  醉话见心
    2021-01-21 11:45

    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

提交回复
热议问题