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
Hi there I have been pained by these drivers lack of proper support for booleans. Whether it is querying the db or inserting an entry with a boolean.
For example BoolHolder foo = new BoolHolder {test = true, id = 1};
This will be added to my database with the boolean being randomly assigned a false or true value.
A simple workaround is doing something like (EDIT: THIS ACTUALLY DOESNT FIX IT SAME ISSUE OCCURS WHEN USING PARAMETERIZED UPDATEDS W/ RAWSQL)
`
var context = GetContext(session);
using (IDbContextTransaction transaction = context.Database.BeginTransaction())
{
try
{
context.Entry(foo).State = EntityState.Added;
await context.SaveChangesAsync();
await transaction.CommitAsync();
await context.Database.ExecuteSqlRawAsync("UPDATE Boolholder SET test = @p0 WHERE id = @p1", foo.test, foo.id);
}
catch (Exception ex)
{
transaction.Rollback();
Console.WriteLine("Error occurred.");
}
}`
And that seems to work fine however this problem is even more of a headache when trying to retrieve data. Trying to query something based on a boolean just straight up does not work. You'd have to workaround it by switching flags to another datatype
Cheers
EDIT: SEE PHOTO BELOW NOT EVEN RAWSQL WORKS WITH PARAMETERISED VALUES ONLY HARD TYPING BOOL VALUES WORK ?????????
Hi there I have been pained by these drivers lack of proper support for booleans. Whether it is querying the db or inserting an entry with a boolean.
For example
BoolHolder foo = new BoolHolder {test = true, id = 1};
`
This will be added to my database with the boolean being randomly assigned a false or true value.
A simple workaround is doing something like
(EDIT: THIS ACTUALLY DOESNT FIX IT SAME ISSUE OCCURS WHEN USING PARAMETERIZED UPDATEDS W/ RAWSQL)
`
And that seems to work fine however this problem is even more of a headache when trying to retrieve data. Trying to query something based on a boolean just straight up does not work. You'd have to workaround it by switching flags to another datatype
Cheers
EDIT: SEE PHOTO BELOW NOT EVEN RAWSQL WORKS WITH PARAMETERISED VALUES ONLY HARD TYPING BOOL VALUES WORK ?????????
Console.WriteLine($"Pickup : {order.Pickup}");
Console.WriteLine($"Pickup : {order.MultiPay}");
await context.Database.ExecuteSqlRawAsync("UPDATE OrderHdr SET Pickup = @p0, Multi_Pay = @p1 WHERE Order_Id = @p2", order.Pickup, order.MultiPay, order.OrderId);
The text was updated successfully, but these errors were encountered: