public static void AddDependencyInjectionSetup(this IServiceCollection services) { if (services == null) { throw new ArgumentNullException(nameof(services)); } NativeInject.RegisterServices(services); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); // Infra Data string connectionString = Configuration.GetConnectionString("Default"); // Identity services.AddIdentity <Usuario, IdentityRole>(options => { options.Password.RequireDigit = false; options.Password.RequireLowercase = false; options.Password.RequireUppercase = false; options.Password.RequiredLength = 6; options.Password.RequireNonAlphanumeric = false; }) .AddDefaultTokenProviders() .AddEntityFrameworkStores <ContextIdentity>() .AddClaimsPrincipalFactory <UsuarioClaimsPrincipalFactory>(); services.AddMvcConfiguration(); services.AddAuthenticationConfiguration(Configuration); services.ConfigureApplicationCookie(opt => { opt.LoginPath = "/Login"; }); // Injeção de Depedencia NativeInject.InjectDependecies(services); services.AddExameTipoImport(); // Cria pasta temporaria se não existir string currentPath = Directory.GetCurrentDirectory(); string pathTmp = Path.Combine(currentPath, "tmp"); bool exists = Directory.Exists(pathTmp); if (!exists) { Directory.CreateDirectory(Path.Combine(currentPath, "tmp")); } services.AddSwaggerConfiguration(); }
public void ConfigureServices(IServiceCollection services) { services.Configure <AppSettings>(_configuration.GetSection( SettingsIntegration.SettingsIntegrations)); NativeInject.RegisterServices(services); services.AddHttpClient <IContractIntegrationWeathermap, ContractIntegrationWeathermap>(); services.AddHttpClient <IContractIntegrationSpotify, ContractIntegrationSpotify>(); services.AddControllers(); services.AddMvc().AddJsonOptions(opcoes => { opcoes.JsonSerializerOptions.IgnoreNullValues = true; }); services.AddSwaggerGen(); }