Error: the entity type requires a primary key

后端 未结 11 1657
走了就别回头了
走了就别回头了 2020-12-02 15:30

I would like to expand the question asked on this thread

Binding listbox to observablecollection

by giving it an ability to persistent the data. The structur

11条回答
  •  南笙
    南笙 (楼主)
    2020-12-02 15:55

    Make sure you have the following condition:

    1. Use [key] if your primary key name is not Id or ID.
    2. Use the public keyword.
    3. Primary key should have getter and setter.

    Example:

    public class MyEntity {
       [key]
       public Guid Id {get; set;}
    }
    

提交回复
热议问题