Compare commits
7 Commits
52c9c9ab9e
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 584d036a09 | |||
| 1da2dd8579 | |||
| b434383f7e | |||
| 3f1371e33a | |||
| 9c1da388d8 | |||
| 1edcafdebd | |||
| 93461fd35e |
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
@@ -10,7 +10,8 @@
|
||||
<Description>Abstract DAL contracts for HrynCo applications: entities, repository and unit-of-work interfaces.</Description>
|
||||
<PackageTags>hrynco dal abstract entity repository unitofwork</PackageTags>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://gitea.grynco.com.ua/hrynco/hrynco-ef.git</RepositoryUrl>
|
||||
<RepositoryUrl>https://gitea.hrynco.com/hrynco/hrynco-ef.git</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
|
||||
@@ -40,7 +40,12 @@ public abstract class BaseEfRepository<TDbContext, TEntity, TEntityId> :
|
||||
{
|
||||
foreach (TEntity entity in entities)
|
||||
{
|
||||
Add(entity, save);
|
||||
Add(entity, save: false);
|
||||
}
|
||||
|
||||
if (save)
|
||||
{
|
||||
DbContext.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +89,11 @@ public abstract class BaseEfRepository<TDbContext, TEntity, TEntityId> :
|
||||
|
||||
public async Task DeleteAsync(TEntityId id)
|
||||
{
|
||||
Delete(id);
|
||||
TEntity? entity = await GetByIdAsync(id);
|
||||
if (entity != null)
|
||||
{
|
||||
DoRemove(entity);
|
||||
}
|
||||
await DbContext.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
@@ -10,7 +10,7 @@
|
||||
<Description>Entity Framework Core base implementations for HrynCo applications: generic repository and unit-of-work.</Description>
|
||||
<PackageTags>hrynco dal ef entityframework repository unitofwork</PackageTags>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>https://gitea.grynco.com.ua/hrynco/hrynco-ef.git</RepositoryUrl>
|
||||
<RepositoryUrl>https://gitea.hrynco.com/hrynco/hrynco-ef.git</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -28,3 +28,4 @@
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user