subida
This commit is contained in:
@@ -4,12 +4,6 @@ using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Options;
|
||||
using SendGrid;
|
||||
using SendGrid.Helpers.Mail;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CleanArchitecture.Infrastructure.Email
|
||||
{
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
using CleanArchitecture.Application.Contracts.Infrastructure;
|
||||
using CleanArchitecture.Application.Contracts.Persistence;
|
||||
using CleanArchitecture.Application.Models;
|
||||
using CleanArchitecture.Infrastructure.Persistence;
|
||||
using CleanArchitecture.Infrastructure.Repositories;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace CleanArchitecture.Infrastructure
|
||||
{
|
||||
public static class InfrastructureServiceRegistration
|
||||
{
|
||||
|
||||
public static IServiceCollection AddInfrastructureServices(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
var dbConnectionString = configuration.GetConnectionString("ConnectionString");
|
||||
services.AddDbContext<StreamerDbContext>(options =>
|
||||
|
||||
options.UseMySql(dbConnectionString, ServerVersion.AutoDetect(dbConnectionString))
|
||||
.LogTo(Console.WriteLine, new[] { DbLoggerCategory.Database.Command.Name }, Microsoft.Extensions.Logging.LogLevel.Information)
|
||||
);
|
||||
|
||||
services.AddScoped(typeof(IAsyncRepository<>), typeof(RepositoryBase<>));
|
||||
services.AddScoped<IVideoRepository, VideoRepository>();
|
||||
services.AddScoped<IStreamerRepository, StreamerRepository>();
|
||||
|
||||
services.Configure<EmailSettings>(c =>configuration.GetSection("EmailSettings"));
|
||||
services.AddTransient<IEmailService, IEmailService>();
|
||||
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,9 @@ namespace CleanArchitecture.Infrastructure.Repositories
|
||||
public class RepositoryBase<T> : IAsyncRepository<T> where T : BaseDomainModel
|
||||
{
|
||||
protected readonly StreamerDbContext context;
|
||||
public RepositoryBase(StreamerDbContext _context)
|
||||
{
|
||||
context = _context;
|
||||
public RepositoryBase(StreamerDbContext _context)
|
||||
{
|
||||
context = _context;
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyList<T>> GetAllAsync()
|
||||
|
||||
Reference in New Issue
Block a user