source: ChapterX.Infrastructure/DependencyInjection.cs@ 877c13c

main
Last change on this file since 877c13c was 877c13c, checked in by kikisrbinoska <srbinoskakristina07@…>, 4 months ago

Added files

  • Property mode set to 100644
File size: 2.4 KB
RevLine 
[877c13c]1using ChapterX.Application.Abstractions;
2using ChapterX.Domain.Repositories;
3using ChapterX.Infrastructure.Data.DataContext;
4using ChapterX.Infrastructure.Repositories;
5using Microsoft.EntityFrameworkCore;
6using Microsoft.Extensions.Configuration;
7using Microsoft.Extensions.DependencyInjection;
8
9namespace ChapterX.Infrastructure
10{
11 public static class DependencyInjection
12 {
13 public static IServiceCollection AddInfrastructure(this IServiceCollection services, IConfiguration configuration)
14 {
15 services.AddDbContext<ApplicationDbContext>(options =>
16 options.UseNpgsql(configuration.GetConnectionString("Database")));
17
18 services.AddScoped<IApplicationDbContext>(sp => sp.GetRequiredService<ApplicationDbContext>());
19
20 services.AddScoped<IUserRepository, UserRepository>();
21 services.AddScoped<IWriterRepository, WriterRepository>();
22 services.AddScoped<IStoryRepository, StoryRepository>();
23 services.AddScoped<IAdminRepository, AdminRepository>();
24 services.AddScoped<IRegularUserRepository, RegularUserRepository>();
25 services.AddScoped<IGenreRepository, GenreRepository>();
26 services.AddScoped<IReadingListRepository, ReadingListRepository>();
27 services.AddScoped<IReadingListItemsRepository, ReadingListItemsRepository>();
28 services.AddScoped<INotificationRepository, NotificationRepository>();
29 services.AddScoped<INotifyRepository, NotifyRepository>();
30 services.AddScoped<INeedApprovalRepository, NeedApprovalRepository>();
31 services.AddScoped<ILikesRepository, LikesRepository>();
32 services.AddScoped<IHasGenreRepository, HasGenreRepository>();
33 services.AddScoped<ICollaborationRepository, CollaborationRepository>();
34 services.AddScoped<IChapterRepository, ChapterRepository>();
35 services.AddScoped<ICommentRepository, CommentRepository>();
36 services.AddScoped<IAISuggestionRepository, AISuggestionRepository>();
37 services.AddScoped<IContentTypeRepository, ContentTypeRepository>();
38 services.AddScoped<IPermissionLevelRepository, PermissionLevelRepository>();
39 services.AddScoped<IRolesRepository, RolesRepository>();
40 services.AddScoped<IStatusRepository, StatusRepository>();
41
42 return services;
43 }
44 }
45}
Note: See TracBrowser for help on using the repository browser.