Skip to content

Commit cf327ee

Browse files
authored
Merge pull request #15 from coderstrong/develop
Add AnyAsync to generic repository
2 parents 1adb953 + c728ce2 commit cf327ee

File tree

6 files changed

+19
-37
lines changed

6 files changed

+19
-37
lines changed

src/MakeSimple.SharedKernel.Infrastructure/Api/ControllerApiBase.cs

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/MakeSimple.SharedKernel.Infrastructure/MakeSimple.SharedKernel.Infrastructure.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFrameworks>netcoreapp3.1;net5.0</TargetFrameworks>
55
<SonarQubeExclude>True</SonarQubeExclude>
66
<SonarQubeTestProject>False</SonarQubeTestProject>
7-
<Version>1.0.13</Version>
7+
<Version>1.0.14</Version>
88
<ApplicationIcon>logo.ico</ApplicationIcon>
99
<Authors>JohnnyTran</Authors>
1010
<Company>MakeSimple</Company>

src/MakeSimple.SharedKernel.Infrastructure/Repository/EfAuditRepositoryGeneric.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,5 +261,10 @@ public void Update(TEntity entity)
261261

262262
_context.Set<TEntity>().Update(entity);
263263
}
264+
265+
public async Task<bool> AnyAsync(Expression<Func<TEntity, bool>> filter)
266+
{
267+
return await _context.Set<TEntity>().AnyAsync(filter).ConfigureAwait(false);
268+
}
264269
}
265270
}

src/MakeSimple.SharedKernel.Infrastructure/Repository/EfRepositoryGeneric.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,5 +247,10 @@ public void Update(TEntity entity)
247247

248248
_context.Set<TEntity>().Update(entity);
249249
}
250+
251+
public async Task<bool> AnyAsync(Expression<Func<TEntity, bool>> filter)
252+
{
253+
return await _context.Set<TEntity>().AnyAsync(filter).ConfigureAwait(false);
254+
}
250255
}
251256
}

src/MakeSimple.SharedKernel/Contract/IRepositoryCore.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,12 @@ PaginationQuery paging
127127
/// </summary>
128128
/// <param name="key"></param>
129129
Task DeleteAsync(object key);
130+
131+
/// <summary>
132+
/// Check exist record on database by filter
133+
/// </summary>
134+
/// <param name="filter"></param>
135+
/// <returns></returns>
136+
Task<bool> AnyAsync(Expression<Func<TEntity, bool>> filter);
130137
}
131138
}

src/MakeSimple.SharedKernel/MakeSimple.SharedKernel.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>netstandard2.1</TargetFramework>
55
<SonarQubeExclude>True</SonarQubeExclude>
6-
<Version>1.0.13</Version>
6+
<Version>1.0.14</Version>
77
<PackageIcon>logo.png</PackageIcon>
88
<NeutralLanguage>en</NeutralLanguage>
99
<ApplicationIcon>logo.ico</ApplicationIcon>

0 commit comments

Comments
 (0)