// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "FamilyMoney.API V1"); }); RegisterMappings.Register(); }
public frmLogin() { InitializeComponent(); RegisterMappings.Register(); _session = SessionFactory.Criar(); }
public Startup(IConfiguration configuration) { Configuration = configuration; //conection = configuration.GetConnectionString("MyConnection"); RegisterMappings.Register(); }
// private List<Permissao> _permissoes; public frmMenu() { InitializeComponent(); BootStrapper.ConfigureStructerMap(); RegisterMappings.Register(); Carregar(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { RegisterMappings.Register(); services.AddSingleton <IFileProvider>( new PhysicalFileProvider( Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"))); services.AddSingleton <ITempDataProvider, CookieTempDataProvider>(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateIssuer = true, ValidateAudience = true, ValidateLifetime = true, ValidateIssuerSigningKey = true, ValidIssuer = Configuration.GetSection(key: "Config")["Issuer"], ValidAudience = Configuration.GetSection(key: "Config")["Issuer"], IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(Configuration.GetSection(key: "Config")["SecretKey"])) }; options.Events = new JwtBearerEvents { OnAuthenticationFailed = context => { Console.WriteLine("OnAuthenticationFailed: " + context.Exception.Message); return(Task.CompletedTask); }, OnTokenValidated = context => { Console.WriteLine("OnTokenValidated: " + context.SecurityToken); return(Task.CompletedTask); } }; }); services.AddMvc(); services.RegisterServices(); services.AddDistributedMemoryCache(); // Adds a default in-memory implementation of IDistributedCache services.AddSession(); services.AddCors(options => { options.AddPolicy("AllowAll", builder => { builder .AllowAnyOrigin() .AllowAnyMethod() .AllowAnyHeader(); }); }); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); RegisterMappings.Register(); }
static void Main(string[] args) { RegisterMappings.Register(); var categories = new CategoryQuery().GetAll(); Console.WriteLine("Categories"); foreach (var category in categories) { Console.WriteLine($"\t{category.Id} | {category.Description}"); } var people = new PersonQuery().GetAll(); Console.WriteLine("People and categories"); foreach (var person in people) { Console.WriteLine($"\t{person.Id} | {person.Name} | {person.Age} | {person.CategoryId} | {person.Category.Description}"); } var peopleProjects = new PersonQuery().GetAllWithProjects(); Console.WriteLine("People and projects"); foreach (var person in peopleProjects) { Console.WriteLine($"\t{person.Id} | {person.Name}"); if (person.Projects != null) { foreach (var project in person.Projects) { Console.WriteLine($"\t\t{project.Id} | {project.Name}"); } } else { Console.WriteLine($"\t\tNo projects"); } } var priorities = new PriorityQuery().GetAll(); Console.WriteLine("Priorities"); foreach (var priority in priorities) { Console.WriteLine($"\t{priority.Id} | {priority.Description}"); } var tickets = new TicketQuery().GetAll(); Console.WriteLine("Tickets"); foreach (var ticket in tickets) { Console.WriteLine($"\t{ticket.Description} | {ticket.PersonId} | {(ticket.Person?.Name ?? "No requester")} | {(ticket.Person?.CategoryId.ToString() ?? "No category id")} | {(ticket.Person?.Category?.Description ?? "No category")} | {(ticket.PriorityId.ToString() ?? "No priority Id")} | {(ticket.Priority?.Description ?? "No Priority")}"); } }
public UsuarioTest() { try { RegisterMappings.Register(); } catch (Exception) { } _logic = new UsuarioLogic(); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // SimpleInjectorInitializer.Initialize(); UnityInitializer.Initialize(); RegisterMappings.Register(); // Application.Run(SimpleInjectorInitializer.Container.GetInstance<Form2>()); Application.Run(UnityInitializer.Container.Resolve <Form2>()); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // SimpleInjectorInitializer.Initialize(); UnityInitializer.Initialize(); RegisterMappings.Register(); //Application.Run(new Form1(new ViewModels.LotacaoViewModel())); Application.Run(UnityInitializer.Container.Resolve <Form1>()); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <CookiePolicyOptions>(options => { // This lambda determines whether user consent for non-essential cookies is needed for a given request. options.CheckConsentNeeded = context => true; options.MinimumSameSitePolicy = SameSiteMode.None; }); services.AddAutoMapper(); NativeInjector.RegisterServices(services); RegisterMappings.Register(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); }
private static void Infra(IServiceCollection services) { //Base RegisterMappings.Register(); services.AddScoped <IUnitOfWork, UnitOfWork>(); services.AddTransient <IDbConnection>(x => new System.Data.SqlClient.SqlConnection("Server=localhost\\SQLEXPRESS;Database=passaro;Trusted_Connection=True;")); services.AddSingleton <CustomMemoryCache>(); //Oferta services.AddTransient <ICategoriaRepository, CategoriaRepository>(); services.AddTransient <IComoUsarRepository, ComoUsarRepository>(); services.AddTransient <IImagemRepository, ImagemRepository>(); services.AddTransient <IOfertaRepository, OfertaRepository>(); services.AddTransient <IOndeFicaRepository, OndeFicaRepository>(); //Pedido services.AddTransient <IPedidoRepository, PedidoRepository>(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } RegisterMappings.Register(); app.UseCors(MyAllowSpecificOrigins); app.UseHttpsRedirection(); app.UseMvc(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { RegisterMappings.Register(); services.AddSingleton <IFileProvider>( new PhysicalFileProvider( Path.Combine(Directory.GetCurrentDirectory(), "wwwroot"))); services.AddSingleton <ITempDataProvider, CookieTempDataProvider>(); services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddScoped <Vereyon.Web.IFlashMessage, Vereyon.Web.FlashMessage>(); services.AddMvc(); services.AddSession(options => { options.IdleTimeout = TimeSpan.FromMinutes(30); }); services.RegisterServices(); services.AddDistributedMemoryCache(); // Adds a default in-memory implementation of IDistributedCache services.AddSession(); }
public void Configuration(IAppBuilder app) { var config = new HttpConfiguration(); RegisterMappings.Register(); config.MapHttpAttributeRoutes(); //config.EnableCors(new EnableCorsAttribute("*", "*", "*")); config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{id}", defaults: new { id = RouteParameter.Optional } ); ConfigureAccessToken(app); app.UseWebApi(config); config.Formatters.Remove(config.Formatters.XmlFormatter); config.Formatters.JsonFormatter.Indent = true; }
public static void DapperTest() { RegisterMappings.Register(); var orders = new OrderDAO().GetAll(); foreach (var order in orders) { order.Details = new OrderDetailDAO().GetAll().Where(x => x.OrderId == order.Id).ToList(); foreach (var detail in order.Details) { detail.Product = new ProductDAO().GetById(detail.ProductId); } Console.WriteLine(order.Total.ToString()); } var product4 = new Product() { Description = " Product 4", Price = 1.00M }; new ProductDAO().Insert(ref product4); var product5 = new Product() { Description = " Product 5", Price = 1.10M }; new ProductDAO().Insert(ref product5); var product6 = new Product() { Description = " Product 6", Price = 1.20M }; new ProductDAO().Insert(ref product6); }
public GenericRepository(IConfiguration configuration) { _connectionString = configuration.GetConnectionString("DefaultConnection"); RegisterMappings.Register(); }
public UnitTest1() { _playerRepository = new PlayerRepository(); RegisterMappings.Register(); }
public BaseRepositoryTest() { RegisterMappings.Register(); }
public Form1() { InitializeComponent(); RegisterMappings.Register(); }
public static void ResolverDependenciasInfra(this IServiceCollection services) { RegisterMappings.Register(); services.AddScoped <IPessoaRepository, PessoaRepository>(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { #region Injeção de dependencia //Configurando a injeção de dependencias dos services ConfigureService.ConfigureDependenciesServices(services); //Configurando a injeção de dependencias dos repositórios ConfigureRepository.ConfigureDependenciesRepository(services); #endregion #region Configurar AutoMapper var config = new AutoMapper.MapperConfiguration(cfg => { cfg.AddProfile(new ParametroSistemaProfile()); }); IMapper mapper = config.CreateMapper(); services.AddSingleton(mapper); #endregion #region Configurando DapperExtensions RegisterMappings.Register(); #endregion #region Log services.AddSingleton(typeof(ILogFacede), typeof(LogFacede)); #endregion #region configurando uso do IIS //services.Configure<IISOptions>(options => //{ // options.AutomaticAuthentication = false; // options.ForwardClientCertificate = false; //}); #endregion services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>(); services.AddScoped <AuthenticatedUser>(); //services.AddMvc().SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_2_2); services.AddControllers(); #region Configurando Swagger #region .NetCore 2.2 ////Adicionando Swagger //services.AddSwaggerGen(c => { // //c.CustomSchemaIds(t =>/ t.FullName); // c.SwaggerDoc("v1", // new Info // { // Title = "Empresa.Sistema - Parâmetros do Sistema", // Version = "v1", // Description = "API REST criada com o ASP.NET Core 2.2 para manter os parâmetros do sistema", // Contact = new Contact // { // Name = "Carlos Rodrigues", // Url = "https://github.com/rodriguescarlos" // } // }); //}); #endregion //Adicionando Swagger services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo { Version = "v1", Title = "API com AspNetCore 3.1", Description = "Arquitetura DDD", TermsOfService = new Uri("https://github.com/rodriguescarlos"), Contact = new OpenApiContact { Name = "Carlos Rodrigues", Email = "*****@*****.**", Url = new Uri("https://github.com/rodriguescarlos") }, License = new OpenApiLicense { Name = "Termo de Licença de Uso", Url = new Uri("https://github.com/rodriguescarlos") } }); //c.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme //{ // Description = "Entre com o Token JWT", // Name = "Authorization", // In = ParameterLocation.Header, // Type = SecuritySchemeType.ApiKey //}); //c.AddSecurityRequirement(new OpenApiSecurityRequirement { //{ // new OpenApiSecurityScheme { // Reference = new OpenApiReference { // Id="Bearer", // Type=ReferenceType.SecurityScheme // } // }, // new List<string>() //} //}); }); #endregion }
public PlayerTest() { _playerRepository = new PlayerRepository(); RegisterMappings.Register(); }
public VendaTest() { RegisterMappings.Register(); vendaBo = new VendaLogic(); }
static void Main(string[] args) { RegisterMappings.Register(); //List<Permissao> _listaPermissao; }
public BaseBusinessTest() { RegisterMappings.Register(); }
protected void Application_Start() { RegisterMappings.Register(); GlobalConfiguration.Configure(WebApiConfig.Register); }
public static void MapearBaseDados() { RegisterMappings.Register(); }