How can I stop EF 7 mapping an entity property to a column?

后端 未结 2 2018
傲寒
傲寒 2021-02-19 11:07

In EF 6, I can add a NotMapped attribute to the property, then it will not be mapped to a column. How can I do this in EF 7?

2条回答
  •  盖世英雄少女心
    2021-02-19 11:52

    We haven't implemented data annotations yet. (See #107) You should be able to do it using the Fluent API.

    modelBuilder.Entity().Ignore(e => e.NotMappedProperty);
    

提交回复
热议问题