| | 1 | | using Domain.Entities; |
| | 2 | | using Microsoft.EntityFrameworkCore; |
| | 3 | | using Microsoft.Extensions.DependencyInjection; |
| | 4 | | using Repository.Persistency.Abstractions; |
| | 5 | | using Repository.Persistency.Generic; |
| | 6 | | using Repository.Persistency.Implementations; |
| | 7 | |
|
| | 8 | | namespace Repository.CommonDependenceInject; |
| | 9 | | public static class RepositoryDependenceInject |
| | 10 | | { |
| | 11 | | public static void CreateDataBaseInMemory(this IServiceCollection services) |
| 0 | 12 | | { |
| 0 | 13 | | services.AddDbContext<RegisterContext>(c => c.UseInMemoryDatabase("Register")); |
| 0 | 14 | | } |
| | 15 | |
|
| | 16 | | public static IServiceCollection AddRepositories(this IServiceCollection services) |
| 2 | 17 | | { |
| 2 | 18 | | services.AddScoped(typeof(IRepositorio<>), typeof(GenericRepositorio<>)); |
| 2 | 19 | | services.AddScoped(typeof(IRepositorio<Categoria>), typeof(CategoriaRepositorioImpl)); |
| 2 | 20 | | services.AddScoped(typeof(IRepositorio<Despesa>), typeof(DespesaRepositorioImpl)); |
| 2 | 21 | | services.AddScoped(typeof(IRepositorio<Receita>), typeof(ReceitaRepositorioImpl)); |
| 2 | 22 | | services.AddScoped(typeof(IRepositorio<Usuario>), typeof(UsuarioRepositorioImpl)); |
| 2 | 23 | | services.AddScoped<IAcessoRepositorioImpl, AcessoRepositorioImpl>(); |
| 2 | 24 | | services.AddScoped(typeof(ILancamentoRepositorio), typeof(LancamentoRepositorioImpl)); |
| 2 | 25 | | services.AddScoped(typeof(ISaldoRepositorio), typeof(SaldoRepositorioImpl)); |
| 2 | 26 | | services.AddScoped(typeof(IGraficosRepositorio), typeof(GraficosRepositorioImpl)); |
| 2 | 27 | | return services; |
| 2 | 28 | | } |
| | 29 | | } |