Merge pull request #16988 from abpframework/UnitOfWorkExtensions

pull/16989/head
maliming 2 years ago committed by GitHub
commit 15c332a8f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,15 +19,8 @@ public static class UnitOfWorkExtensions
{
Check.NotNull(unitOfWork, nameof(unitOfWork));
if (!unitOfWork.Items.ContainsKey(key))
{
unitOfWork.Items[key] = value;
}
else
{
unitOfWork.Items.Add(key, value);
}
}
public static TValue GetItemOrDefault<TValue>([NotNull] this IUnitOfWork unitOfWork, string key)
where TValue : class

@ -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]

Loading…
Cancel
Save