Browse Source
Merge pull request #16989 from abpframework/auto-merge/rel-7-0/2040
pull/16990/head
maliming
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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] |
|
|
|
|