Przeglądaj źródła

修正DbSet的AddOrUpdate的bug

懒得勤快 3 lat temu
rodzic
commit
502c57da6f

+ 1 - 1
Masuit.Tools.AspNetCore/Masuit.Tools.AspNetCore.csproj

@@ -17,7 +17,7 @@
         <Product>Masuit.Tools.AspNetCore</Product>
         <PackageId>Masuit.Tools.AspNetCore</PackageId>
         <LangVersion>latest</LangVersion>
-        <Version>1.1.6.2</Version>
+        <Version>1.1.6.3</Version>
         <RepositoryType></RepositoryType>
         <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
         <FileVersion>$(Version)</FileVersion>

+ 3 - 3
Masuit.Tools.Core/AspNetCore/DbSetExtensions.cs

@@ -75,7 +75,7 @@ namespace Masuit.Tools.Core.AspNetCore
                             continue;
                         }
 
-                        var existingValue = p.GetValue(items[key]);
+                        var existingValue = p.GetValue(entity);
                         if (p.GetValue(items[key]) != existingValue)
                         {
                             p.SetValue(items[key], existingValue);
@@ -85,9 +85,9 @@ namespace Masuit.Tools.Core.AspNetCore
                     foreach (var idField in keyIgnoreFields.Where(p => p.SetMethod != null && p.GetMethod != null))
                     {
                         var existingValue = idField.GetValue(items[key]);
-                        if (idField.GetValue(items[key]) != existingValue)
+                        if (idField.GetValue(entity) != existingValue)
                         {
-                            idField.SetValue(items[key], existingValue);
+                            idField.SetValue(entity, existingValue);
                         }
                     }
                 }

+ 1 - 1
Masuit.Tools.Core/Masuit.Tools.Core.csproj

@@ -20,7 +20,7 @@ github:https://github.com/ldqk/Masuit.Tools
         <UserSecretsId>830c282f-f7c1-42be-8651-4cd06ac8e73f</UserSecretsId>
         <RepositoryType></RepositoryType>
         <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
-        <Version>2.5.6.2</Version>
+        <Version>2.5.6.3</Version>
         <FileVersion>$(Version)</FileVersion>
         <Company>masuit.org</Company>
         <AssemblyVersion>$(Version)</AssemblyVersion>