diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs index d63a93f8dd..5b8e9e6678 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; +using System.Globalization; using System.Linq; using System.Linq.Expressions; using System.Reflection; @@ -322,9 +323,17 @@ namespace Volo.Abp.EntityFrameworkCore var entryProperty = entry.Property(property.Name); - entryProperty.CurrentValue = entryProperty.Metadata.ClrType == entityProperty.GetType() - ? entityProperty - : Convert.ChangeType(entityProperty, entryProperty.Metadata.ClrType); + if (entryProperty.Metadata.ClrType == entityProperty.GetType()) + { + entryProperty.CurrentValue = entityProperty; + } + else + { + if (TypeHelper.IsPrimitiveExtended(entryProperty.Metadata.ClrType, includeEnums: true)) + { + entryProperty.CurrentValue = Convert.ChangeType(entityProperty, entryProperty.Metadata.ClrType, CultureInfo.InvariantCulture); + } + } } }