Browse Source
Fix `AddItem` extension method of `UnitOfWorkExtensions`.
pull/16988/head
maliming
3 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
2 changed files with
6 additions and
8 deletions
-
framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkExtensions.cs
-
framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWorkExtensions_Tests.cs
|
|
|
@ -19,14 +19,7 @@ public static class UnitOfWorkExtensions |
|
|
|
{ |
|
|
|
Check.NotNull(unitOfWork, nameof(unitOfWork)); |
|
|
|
|
|
|
|
if (!unitOfWork.Items.ContainsKey(key)) |
|
|
|
{ |
|
|
|
unitOfWork.Items[key] = value; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
unitOfWork.Items.Add(key, value); |
|
|
|
} |
|
|
|
unitOfWork.Items[key] = value; |
|
|
|
} |
|
|
|
|
|
|
|
public static TValue GetItemOrDefault<TValue>([NotNull] this IUnitOfWork unitOfWork, string key) |
|
|
|
|
|
|
|
@ -21,6 +21,11 @@ public class UnitOfWorkExtensions_Tests : AbpIntegratedTest<AbpUnitOfWorkModule> |
|
|
|
|
|
|
|
uow.Items.ShouldContainKey("testKey"); |
|
|
|
uow.Items.ContainsValue("testValue"); |
|
|
|
|
|
|
|
uow.AddItem("testKey", "testValue2"); |
|
|
|
|
|
|
|
uow.Items.ShouldContainKey("testKey"); |
|
|
|
uow.Items.ContainsValue("testValue2"); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
|