Dapper use singular table name

前端 未结 2 2004
北荒
北荒 2021-01-11 09:38

I experimented with Dapper and Dapper.Contrib. I have the following class:

public class Customer
{
    public int Id { get; set; }
    public string FirstNam         


        
2条回答
  •  甜味超标
    2021-01-11 10:16

    Use the 'Table' data annotation attribute on your entity class as follows:

    [Table("Customer")]
    public class Customer
    {
        public int Id { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public DateTime DateOfBirth { get; set; }
        public bool Active { get; set; }
    }
    

提交回复
热议问题