I am trying to implement caching on our database transaction and I want them to add,update and delete from cache as equivalent database operations happen.
public class ModelExample
{
public string code { get; set; }
public string description { get; set; }
public string site { get; set; }
}
say I have a method that inserts into the table
int result;
string query = "insert into modeltable(code,description,site) values (@code,@description,@site);
DynamicParameters parameter = new DynamicParameters();
parameter.Add("@code", code, DbType.String);
parameter.Add("@description", description, DbType.String);
parameter.Add("@site", site, DbType.String);
connection.Open();
result = await connection.ExecuteAsync(query, parameter)
I want the result to actual return the ModelClass, instead of an integer. So basically, I want the results of the insert so that i can add it to the cache.
Thanks