Skip to content

Commit 0c1943a

Browse files
committed
Repository Design
1 parent bd64ccd commit 0c1943a

20 files changed

Lines changed: 381 additions & 4 deletions

Core/ETicaretAPI.Application/ETicaretAPI.Application.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

9+
<ItemGroup>
10+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.1" />
11+
</ItemGroup>
12+
913
<ItemGroup>
1014
<ProjectReference Include="..\ETicaretAPI.Domain\ETicaretAPI.Domain.csproj" />
1115
</ItemGroup>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using ETicaretAPI.Domain.Entities;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace ETicaretAPI.Application.Repositories
9+
{
10+
public interface ICustomerReadRepository : IReadRepository<Customer>
11+
{
12+
13+
}
14+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using ETicaretAPI.Domain.Entities;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace ETicaretAPI.Application.Repositories
9+
{
10+
public interface ICustomerWriteRepository : IWriteRepository<Customer>
11+
{
12+
}
13+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using ETicaretAPI.Domain.Entities.Common;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Linq.Expressions;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace ETicaretAPI.Application.Repositories
10+
{
11+
public interface IReadRepository<T> : IRepository<T> where T : BaseEntity
12+
{
13+
IQueryable<T> GetAll();
14+
IQueryable<T> GetWhere(Expression<Func<T,bool>> method);
15+
Task<T> GetSingleAsync(Expression<Func<T, bool>> method);
16+
Task<T> GetByIdAsync(string id);
17+
}
18+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using ETicaretAPI.Domain.Entities.Common;
2+
using Microsoft.EntityFrameworkCore;
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace ETicaretAPI.Application.Repositories
10+
{
11+
public interface IRepository<T> where T : BaseEntity
12+
{
13+
DbSet<T> Table { get; }
14+
}
15+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using ETicaretAPI.Domain.Entities.Common;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace ETicaretAPI.Application.Repositories
9+
{
10+
public interface IWriteRepository<T> : IRepository<T> where T : BaseEntity
11+
{
12+
Task<bool> AddAsync(T model);
13+
Task<bool> AddRangeAsync(List<T> datas);
14+
bool Update(T model);
15+
bool Remove(T model);
16+
bool RemoveRange(List<T> datas);
17+
Task<bool> RemoveAsync(string id);
18+
19+
Task<int> SaveAsync();
20+
}
21+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using ETicaretAPI.Domain.Entities;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace ETicaretAPI.Application.Repositories
9+
{
10+
public interface IOrderReadRepository : IReadRepository<Order>
11+
{
12+
13+
}
14+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using ETicaretAPI.Domain.Entities;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace ETicaretAPI.Application.Repositories
9+
{
10+
public interface IOrderWriteRepository:IWriteRepository<Order>
11+
{
12+
}
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using ETicaretAPI.Domain.Entities;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace ETicaretAPI.Application.Repositories
9+
{
10+
public interface IProductReadRepository:IReadRepository<Product>
11+
{
12+
13+
}
14+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using ETicaretAPI.Domain.Entities;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace ETicaretAPI.Application.Repositories
9+
{
10+
public interface IProductWriteRepository:IWriteRepository<Product>
11+
{
12+
13+
}
14+
}

0 commit comments

Comments
 (0)