✨
This commit is contained in:
45
StopShopping.Services/Extensions/ServicesExtensions.cs
Normal file
45
StopShopping.Services/Extensions/ServicesExtensions.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using FileSignatures;
|
||||
using FileSignatures.Formats;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using StopShopping.EF;
|
||||
using StopShopping.Services;
|
||||
using StopShopping.Services.Extensions;
|
||||
using StopShopping.Services.Implementions;
|
||||
|
||||
namespace Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
public static class ServicesExtensions
|
||||
{
|
||||
public static IServiceCollection AddServices(
|
||||
this IServiceCollection services,
|
||||
Action<DbContextOptionsBuilder> dbContextOptions,
|
||||
IConfiguration appOptions,
|
||||
IConfiguration openPlatformOptions)
|
||||
{
|
||||
services.AddDbContext<StopShoppingContext>(dbContextOptions);
|
||||
|
||||
services.Configure<AppOptions>(appOptions);
|
||||
|
||||
var imageFormats = FileFormatLocator.GetFormats().OfType<Image>();
|
||||
var imageInspector = new FileFormatInspector(imageFormats);
|
||||
services.AddSingleton<IFileFormatInspector>(imageInspector);
|
||||
|
||||
services.AddSingleton<ICipherService, CipherService>();
|
||||
services.AddSingleton<ISerialNoGenerator, NanoidSerialNoGenerator>();
|
||||
|
||||
services.AddScoped<IDistrictService, DistrictService>();
|
||||
services.AddScoped<IClaimsService, ClaimsService>();
|
||||
services.AddScoped<IFileService, FileService>();
|
||||
services.AddScoped<IAccessTokenService, AccessTokenService>();
|
||||
services.AddScoped<IUserService, UserService>();
|
||||
services.AddScoped<ICategoryService, CategoryService>();
|
||||
services.AddScoped<IProductService, ProductService>();
|
||||
services.AddScoped<IRequestService, RequestService>();
|
||||
services.AddScoped<IReplyService, ReplyService>();
|
||||
|
||||
services.AddOpenPlatformServices(openPlatformOptions);
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user