Convert property values using type converters in BulkUpsert.
Added logic to handle type conversion using `ConvertToProvider` for properties with defined type converters. This ensures compatibility and consistency when interacting with the database in bulk upsert operations.
This commit is contained in:
parent
74f9b06bdd
commit
10cc005848
|
|
@ -119,6 +119,10 @@ public static class BulkUpsertExtensions
|
|||
object? value = property.IsShadowProperty()
|
||||
? dbContext.Entry(entity).Property(property.Name).CurrentValue
|
||||
: property.PropertyInfo?.GetValue(entity);
|
||||
|
||||
var converter = property.GetTypeMapping().Converter;
|
||||
if (converter != null)
|
||||
value = converter.ConvertToProvider(value);
|
||||
|
||||
values.Add(paramName);
|
||||
parameters.Add(value);
|
||||
|
|
@ -175,6 +179,10 @@ public static class BulkUpsertExtensions
|
|||
object? value = property.IsShadowProperty()
|
||||
? dbContext.Entry(entity).Property(property.Name).CurrentValue
|
||||
: property.PropertyInfo?.GetValue(entity);
|
||||
|
||||
var converter = property.GetTypeMapping().Converter;
|
||||
if (converter != null)
|
||||
value = converter.ConvertToProvider(value);
|
||||
|
||||
placeholders.Add(paramName);
|
||||
parameters.Add(value);
|
||||
|
|
@ -233,6 +241,10 @@ public static class BulkUpsertExtensions
|
|||
object? value = property.IsShadowProperty()
|
||||
? dbContext.Entry(entity).Property(property.Name).CurrentValue
|
||||
: property.PropertyInfo?.GetValue(entity);
|
||||
|
||||
var converter = property.GetTypeMapping().Converter;
|
||||
if (converter != null)
|
||||
value = converter.ConvertToProvider(value);
|
||||
|
||||
placeholders.Add(paramName);
|
||||
parameters.Add(value);
|
||||
|
|
@ -291,6 +303,10 @@ public static class BulkUpsertExtensions
|
|||
object? value = property.IsShadowProperty()
|
||||
? dbContext.Entry(entity).Property(property.Name).CurrentValue
|
||||
: property.PropertyInfo?.GetValue(entity);
|
||||
|
||||
var converter = property.GetTypeMapping().Converter;
|
||||
if (converter != null)
|
||||
value = converter.ConvertToProvider(value);
|
||||
|
||||
placeholders.Add(paramName);
|
||||
parameters.Add(value);
|
||||
|
|
@ -353,6 +369,10 @@ public static class BulkUpsertExtensions
|
|||
object? value = property.IsShadowProperty()
|
||||
? dbContext.Entry(entity).Property(property.Name).CurrentValue
|
||||
: property.PropertyInfo?.GetValue(entity);
|
||||
|
||||
var converter = property.GetTypeMapping().Converter;
|
||||
if (converter != null)
|
||||
value = converter.ConvertToProvider(value);
|
||||
|
||||
parameters.Add(value);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue