Skip to content

Commit 28b5b4a

Browse files
committed
Change package name and remove ConfigureAwait methods.
1 parent e5e10f3 commit 28b5b4a

6 files changed

Lines changed: 30 additions & 30 deletions

File tree

GenericRepository/GenericRepository.csproj

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>disable</Nullable>
77
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
8-
<Title>EntityFrameworkCore.GenericRepository</Title>
8+
<Title>TS GenericRepository</Title>
99
<Company>Taner Saydam</Company>
10-
<Description>This is a Generic Repository Service for Entity Framework Core</Description>
11-
<PackageIcon>icon.jpeg</PackageIcon>
10+
<Description>This is a Generic Repository Service for Entity Framework Core with .NET Core</Description>
11+
<PackageIcon>logo.jpg</PackageIcon>
1212
<PackageReadmeFile>README.md</PackageReadmeFile>
1313
<RepositoryUrl>https://github.com/TanerSaydam/GenericRepositoryNugetPackage</RepositoryUrl>
14-
<PackageId>EntityFrameworkCore.GenericRepository.Nuget</PackageId>
14+
<PackageId>TS.EntityFrameworkCore.GenericRepository</PackageId>
1515
<AssemblyVersion></AssemblyVersion>
1616
<FileVersion></FileVersion>
17-
<Version>8.0.1</Version>
17+
<Version>8.0.0</Version>
1818
<Authors>Taner Saydam</Authors>
1919
<PackageTags>genericrepository</PackageTags>
20+
<Product>Generic Repository</Product>
2021
</PropertyGroup>
2122

2223
<ItemGroup>
@@ -31,7 +32,7 @@
3132
</ItemGroup>
3233

3334
<ItemGroup>
34-
<None Update="icon.jpeg">
35+
<None Update="logo.jpg">
3536
<Pack>True</Pack>
3637
<PackagePath>\</PackagePath>
3738
</None>

GenericRepository/IRepository.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ public interface IRepository<TEntity>
77
{
88
IQueryable<TEntity> GetAll();
99
IQueryable<TEntity> GetAllWithTacking();
10-
IQueryable<TEntity> GetWhere(Expression<Func<TEntity, bool>> expression);
11-
IQueryable<TEntity> GetWhereWithTracking(Expression<Func<TEntity, bool>> expression);
10+
IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> expression);
11+
IQueryable<TEntity> WhereWithTracking(Expression<Func<TEntity, bool>> expression);
1212
Task<TEntity> GetByExpressionAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancellationToken = default);
1313
Task<TEntity> GetByExpressionWithTrackingAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancellationToken = default);
1414
Task<TEntity> GetFirstAsync(CancellationToken cancellationToken = default);

GenericRepository/Repository.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using Microsoft.EntityFrameworkCore;
22
using System.Linq.Expressions;
3-
using System.Threading;
43

54
namespace GenericRepository;
65

@@ -24,12 +23,12 @@ public void Add(TEntity entity)
2423

2524
public async Task AddAsync(TEntity entity, CancellationToken cancellationToken = default)
2625
{
27-
await Entity.AddAsync(entity, cancellationToken).ConfigureAwait(false);
26+
await Entity.AddAsync(entity, cancellationToken);
2827
}
2928

3029
public async Task AddRangeAsync(ICollection<TEntity> entities, CancellationToken cancellationToken = default)
3130
{
32-
await Entity.AddRangeAsync(entities, cancellationToken).ConfigureAwait(false);
31+
await Entity.AddRangeAsync(entities, cancellationToken);
3332
}
3433

3534
public bool Any(Expression<Func<TEntity, bool>> expression)
@@ -49,13 +48,13 @@ public void Delete(TEntity entity)
4948

5049
public async Task DeleteByExpressionAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancellationToken = default)
5150
{
52-
TEntity entity = await Entity.Where(expression).AsNoTracking().FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false);
51+
TEntity entity = await Entity.Where(expression).AsNoTracking().FirstOrDefaultAsync(cancellationToken);
5352
Entity.Remove(entity);
5453
}
5554

5655
public async Task DeleteByIdAsync(string id)
5756
{
58-
TEntity entity = await Entity.FindAsync(id).ConfigureAwait(false);
57+
TEntity entity = await Entity.FindAsync(id);
5958
Entity.Remove(entity);
6059
}
6160

@@ -82,7 +81,7 @@ public TEntity GetByExpression(Expression<Func<TEntity, bool>> expression)
8281

8382
public async Task<TEntity> GetByExpressionAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancellationToken = default)
8483
{
85-
TEntity entity = await Entity.Where(expression).AsNoTracking().FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false);
84+
TEntity entity = await Entity.Where(expression).AsNoTracking().FirstOrDefaultAsync(cancellationToken);
8685
return entity;
8786
}
8887

@@ -94,7 +93,7 @@ public TEntity GetByExpressionWithTracking(Expression<Func<TEntity, bool>> expre
9493

9594
public async Task<TEntity> GetByExpressionWithTrackingAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancellationToken = default)
9695
{
97-
TEntity entity = await Entity.Where(expression).FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false);
96+
TEntity entity = await Entity.Where(expression).FirstOrDefaultAsync(cancellationToken);
9897
return entity;
9998
}
10099

@@ -106,16 +105,16 @@ public TEntity GetFirst()
106105

107106
public async Task<TEntity> GetFirstAsync(CancellationToken cancellationToken = default)
108107
{
109-
TEntity entity = await Entity.AsNoTracking().FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false);
108+
TEntity entity = await Entity.AsNoTracking().FirstOrDefaultAsync(cancellationToken);
110109
return entity;
111110
}
112111

113-
public IQueryable<TEntity> GetWhere(Expression<Func<TEntity, bool>> expression)
112+
public IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> expression)
114113
{
115114
return Entity.AsNoTracking().Where(expression).AsQueryable();
116115
}
117116

118-
public IQueryable<TEntity> GetWhereWithTracking(Expression<Func<TEntity, bool>> expression)
117+
public IQueryable<TEntity> WhereWithTracking(Expression<Func<TEntity, bool>> expression)
119118
{
120119
return Entity.Where(expression).AsQueryable();
121120
}

GenericRepository/icon.jpeg

-6.84 KB
Binary file not shown.

GenericRepository/logo.jpg

476 KB
Loading

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public async Task AddAsync(User user, CancellationToken cancellationToken)
4242

4343
public async Task<IList<User>> GetAllAsync(CancellationToken cancellationToken)
4444
{
45-
IList<User> users = await _userRepository.GetAll().ToListAsync(cancellationToken).ConfigureAwait(false);
45+
IList<User> users = await _userRepository.GetAll().ToListAsync(cancellationToken);
4646
return users;
4747
}
4848
```
@@ -63,8 +63,8 @@ public interface IRepository<TEntity>
6363
{
6464
IQueryable<TEntity> GetAll();
6565
IQueryable<TEntity> GetAllWithTacking();
66-
IQueryable<TEntity> GetWhere(Expression<Func<TEntity, bool>> expression);
67-
IQueryable<TEntity> GetWhereWithTracking(Expression<Func<TEntity, bool>> expression);
66+
IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> expression);
67+
IQueryable<TEntity> WhereWithTracking(Expression<Func<TEntity, bool>> expression);
6868
Task<TEntity> GetByExpressionAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancellationToken = default);
6969
Task<TEntity> GetByExpressionWithTrackingAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancellationToken = default);
7070
Task<TEntity> GetFirstAsync(CancellationToken cancellationToken = default);
@@ -107,12 +107,12 @@ public class Repository<TEntity, TContext> : IRepository<TEntity>
107107

108108
public async Task AddAsync(TEntity entity, CancellationToken cancellationToken = default)
109109
{
110-
await Entity.AddAsync(entity, cancellationToken).ConfigureAwait(false);
110+
await Entity.AddAsync(entity, cancellationToken);
111111
}
112112

113113
public async Task AddRangeAsync(ICollection<TEntity> entities, CancellationToken cancellationToken = default)
114114
{
115-
await Entity.AddRangeAsync(entities, cancellationToken).ConfigureAwait(false);
115+
await Entity.AddRangeAsync(entities, cancellationToken);
116116
}
117117

118118
public bool Any(Expression<Func<TEntity, bool>> expression)
@@ -132,13 +132,13 @@ public class Repository<TEntity, TContext> : IRepository<TEntity>
132132

133133
public async Task DeleteByExpressionAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancellationToken = default)
134134
{
135-
TEntity entity = await Entity.Where(expression).AsNoTracking().FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false);
135+
TEntity entity = await Entity.Where(expression).AsNoTracking().FirstOrDefaultAsync(cancellationToken);
136136
Entity.Remove(entity);
137137
}
138138

139139
public async Task DeleteByIdAsync(string id)
140140
{
141-
TEntity entity = await Entity.FindAsync(id).ConfigureAwait(false);
141+
TEntity entity = await Entity.FindAsync(id);
142142
Entity.Remove(entity);
143143
}
144144

@@ -165,7 +165,7 @@ public class Repository<TEntity, TContext> : IRepository<TEntity>
165165

166166
public async Task<TEntity> GetByExpressionAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancellationToken = default)
167167
{
168-
TEntity entity = await Entity.Where(expression).AsNoTracking().FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false);
168+
TEntity entity = await Entity.Where(expression).AsNoTracking().FirstOrDefaultAsync(cancellationToken);
169169
return entity;
170170
}
171171

@@ -177,7 +177,7 @@ public class Repository<TEntity, TContext> : IRepository<TEntity>
177177

178178
public async Task<TEntity> GetByExpressionWithTrackingAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancellationToken = default)
179179
{
180-
TEntity entity = await Entity.Where(expression).FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false);
180+
TEntity entity = await Entity.Where(expression).FirstOrDefaultAsync(cancellationToken);
181181
return entity;
182182
}
183183

@@ -189,16 +189,16 @@ public class Repository<TEntity, TContext> : IRepository<TEntity>
189189

190190
public async Task<TEntity> GetFirstAsync(CancellationToken cancellationToken = default)
191191
{
192-
TEntity entity = await Entity.AsNoTracking().FirstOrDefaultAsync(cancellationToken).ConfigureAwait(false);
192+
TEntity entity = await Entity.AsNoTracking().FirstOrDefaultAsync(cancellationToken);
193193
return entity;
194194
}
195195

196-
public IQueryable<TEntity> GetWhere(Expression<Func<TEntity, bool>> expression)
196+
public IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> expression)
197197
{
198198
return Entity.AsNoTracking().Where(expression).AsQueryable();
199199
}
200200

201-
public IQueryable<TEntity> GetWhereWithTracking(Expression<Func<TEntity, bool>> expression)
201+
public IQueryable<TEntity> WhereWithTracking(Expression<Func<TEntity, bool>> expression)
202202
{
203203
return Entity.Where(expression).AsQueryable();
204204
}

0 commit comments

Comments
 (0)