Hi ServiceStack,
I’m using version 4.5.14 (I’ve the same problem with 4.5.12, I’ve non tried with older versions). I’ve the following code
void Main()
{
var connectionString = "SERVER=...; DATABASE=...; USER ID=...; PASSWORD=...;";
var dbFactory = new OrmLiteConnectionFactory(connectionString, SqlServerDialect.Provider);
using (var db = dbFactory.Open())
{
db.CreateTableIfNotExists<UserRole>();
// This doesn't work: throws SqlException (Must declare the scalar variable "@0").
db.SaveAll(new[]
{
new UserRole { Name = "Admin" },
new UserRole { Name = "Reader" },
new UserRole { Name = "Writer" },
});
// This correctly works.
// db.Save(new UserRole { Name = "Admin" });
// db.Save(new UserRole { Name = "Reader" });
// db.Save(new UserRole { Name = "Writer" });
}
}
// ...
class UserRole
{
public string Name { get; set; }
}
If I use the Save method all works fine instead, if I use SaveAll method I get the reported exception.
Thanks.