-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: ♻️ some refactoring for adding modules
- Loading branch information
mehdihadeli
committed
Jun 13, 2023
1 parent
8b3a6e7
commit c6d0045
Showing
32 changed files
with
146 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/Vertical.Slice.Template.Shared/Abstractions/Ef/Repository/IReadRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
using Ardalis.Specification; | ||
|
||
namespace Vertical.Slice.Template.Shared.Abstractions.Ef.Repository; | ||
|
||
public interface IReadRepository<T> : IReadRepositoryBase<T> | ||
where T : class { } |
7 changes: 7 additions & 0 deletions
7
src/Vertical.Slice.Template.Shared/Abstractions/Ef/Repository/IRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using Ardalis.Specification; | ||
|
||
namespace Vertical.Slice.Template.Shared.Abstractions.Ef.Repository; | ||
|
||
// from Ardalis.Specification | ||
public interface IRepository<T> : IRepositoryBase<T> | ||
where T : class { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/Vertical.Slice.Template.Shared/Core/Ef/EfRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Ardalis.Specification.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore; | ||
using Vertical.Slice.Template.Shared.Abstractions.Ef.Repository; | ||
|
||
namespace Vertical.Slice.Template.Shared.Core.Ef; | ||
|
||
// inherit from Ardalis.Specification type | ||
public class EfRepository<T, TContext> : RepositoryBase<T>, IReadRepository<T>, IRepository<T> | ||
where T : class | ||
where TContext : DbContext | ||
{ | ||
public EfRepository(TContext dbContext) | ||
: base(dbContext) { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ServiceCollectionExtensions.Dependency.cs → ...ServiceCollectionExtensions.Dependency.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Vertical.Slice.Template.Shared/Web/Extensions/CorsExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...pplicationBuilderExtensions.Versioning.cs → ...pplicationBuilderExtensions.Versioning.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...e/CaptureExceptionMiddlewareExtensions.cs → ...e/CaptureExceptionMiddlewareExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ts/Data/SieveProductReadConfigurations.cs → ...rations/SieveProductReadConfigurations.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/Vertical.Slice.Template/Shared/CatalogsConfigurations.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using Microsoft.AspNetCore.Builder; | ||
using Microsoft.AspNetCore.Http; | ||
using Microsoft.AspNetCore.Routing; | ||
using Vertical.Slice.Template.Products; | ||
using Vertical.Slice.Template.Shared.Extensions.WebApplicationBuilderExtensions; | ||
using Vertical.Slice.Template.Shared.Extensions.WebApplicationExtensions; | ||
|
||
namespace Vertical.Slice.Template.Shared; | ||
|
||
public static class CatalogsConfigurations | ||
{ | ||
public const string CatalogsPrefixUri = "api/v{version:apiVersion}/catalogs"; | ||
|
||
public static WebApplicationBuilder AddCatalogsServices(this WebApplicationBuilder builder) | ||
{ | ||
// Shared | ||
builder.AddInfrastructures(); | ||
builder.AddStorage(); | ||
|
||
// Modules | ||
builder.AddProductsServices(); | ||
|
||
return builder; | ||
} | ||
|
||
public static async Task<WebApplication> UseCatalogs(this WebApplication app) | ||
{ | ||
// Shared | ||
await app.UseInfrastructure(); | ||
|
||
// Modules | ||
await app.UseProducts(); | ||
|
||
return app; | ||
} | ||
|
||
public static IEndpointRouteBuilder MapCatalogsEndpoints(this IEndpointRouteBuilder endpoints) | ||
{ | ||
// Shared | ||
endpoints.MapGet("/", () => "Catalogs Api.").ExcludeFromDescription(); | ||
|
||
// Modules | ||
endpoints.MapProductsEndpoints(); | ||
|
||
return endpoints; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Vertical.Slice.Template/Shared/Data/GenericRepository.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using Vertical.Slice.Template.Shared.Core.Ef; | ||
|
||
namespace Vertical.Slice.Template.Shared.Data; | ||
|
||
public class GenericRepository<T> : EfRepository<T, CatalogsDbContext> | ||
where T : class | ||
{ | ||
public GenericRepository(CatalogsDbContext dbContext) | ||
: base(dbContext) { } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.