I am new to Dapper
and Dapper.Contrib
. There is a class like this and there is a table in database with the same name:
public class Ware
{
public int ID { get; set; }
public string Name { get; set; }
public short UnitID { get; set; }
public short TypeID { get; set; }
public int CableCodeID { get; set; }
public string Tag1 { get; set; }
public string Tag2 { get; set; }
public bool Discontinued { get; set; }
public decimal Stock { get; set; } //this is not in database. this is helper
public string UnitCaption { get; set; } //this is not in database. this is helper
public string TypeCaption { get; set; } //this is not in database. this is helper
public string FullCaption //this is not in database. this is helper
{
get
{
return $"{ID} {Name}";
}
}
}
I need to Update a whole list of this class to database. I use:
conection.Update(myList); // myList is List<Ware>
But it has an error when it run's:
System.Data.SqlClient.SqlException: 'Invalid column name 'Stock'.'
System.Data.SqlClient.SqlException: 'Invalid column name 'UnitCaption'.'
System.Data.SqlClient.SqlException: 'Invalid column name 'TypeCaption'.'
System.Data.SqlClient.SqlException: 'Invalid column name 'FullCaption'.'
How to fix this?