Answers for "dapper insert record when entity properties have the same names as the SQL columns."

0

dapper insert record when entity properties have the same names as the SQL columns.

using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["myDbConnection"].ConnectionString))
{
    string insertQuery = @"INSERT INTO [dbo].[Customer]([FirstName], [LastName], [State], [City], [IsActive], [CreatedOn]) VALUES (@FirstName, @LastName, @State, @City, @IsActive, @CreatedOn)";

    var result = db.Execute(insertQuery, customerViewModel);
}
Posted by: Guest on September-30-2021

Code answers related to "dapper insert record when entity properties have the same names as the SQL columns."

Browse Popular Code Answers by Language