I'm a new baby in Dapper. Trying to incorporate CRUD operations with Dapper and Dapper.SimpleCRUD lib. Here is the sample code...
My Data Model Looks like
Class Product
{
public string prodId {get;set;}
public string prodName {get;set;}
public string Location {get;set;}
}
Dapper Implementation - Insert
public void Insert(Product item)
{
using(var con = GetConnection())
{
con.Insert(item);
}
}
Since the ProdId in the Db is an Identity Column it fails. How does it indicate ProdId is an Identity Column in DB?
Dapper Implementation - Get
public IEnumerable<Product> GetAll()
{
IEnumerable<Product> item = null;
using (var con = GetConnection())
{
item = con.GetList<Product>();
}
return item;
}
It gives an exception:
"Entity must have at least one [Key] property"!