You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using the latest NuGet package 1.7.0, simple Update operations fail with the error: Insufficient parameters supplied to the command. This happens if there is a Guid property present on the entity. The same works in version 1.6.3.
Code to reproduce:
// Add reference to NuGet: System.Data.SQLite
// Add reference to NuGet: Dapper.Extensions
using Dapper;
using DapperExtensions;
using System.Data.SQLite;
public static void Main()
{
string tempDb = Path.Combine(Path.GetTempPath(), $"DB_{Guid.NewGuid()}.sqlite");
SQLiteConnection connection = new SQLiteConnection();
connection.ParseViaFramework = true;
connection.ConnectionString = $"data source=\"{tempDb}\";failifmissing=False;foreign keys=False;binaryguid=True";
connection.Open();
using (SQLiteCommand command = connection.CreateCommand())
{
command.CommandText = "CREATE TABLE [Entities] ([Id] guid PRIMARY KEY NOT NULL, [Name] text);";
command.ExecuteNonQuery();
command.CommandText = "INSERT INTO [Entities] ([Id], [Name]) VALUES ('02D16168-1E2E-4D5B-97E1-6CFCA3EF4B87', 'John');";
command.ExecuteNonQuery();
}
DapperExtensions.DapperExtensions.SqlDialect = new DapperExtensions.Sql.SqliteDialect();
DapperExtensions.DapperExtensions.DefaultMapper = typeof(DapperExtensions.Mapper.PluralizedAutoClassMapper<>);
string sql = "SELECT * FROM [Entities]";
Entity entity = connection.Query<Entity>(sql).ToArray().First();
System.Diagnostics.Debug.Assert(entity.Name == "John");
entity.Name = "Doe";
connection.Update<Entity>(entity); // <--- Fails Here !!!!
connection.Close();
File.Delete(tempDb);
}
private class Entity
{
[System.ComponentModel.DataAnnotations.Key]
public Guid Id { get; set; }
public string Name { get; set; }
}
The text was updated successfully, but these errors were encountered:
Using the latest NuGet package 1.7.0, simple Update operations fail with the error: Insufficient parameters supplied to the command. This happens if there is a Guid property present on the entity. The same works in version 1.6.3.
Code to reproduce:
The text was updated successfully, but these errors were encountered: