public void Initialize() { MapperBL.Initialize(); categoryBL = new CategoryBL(new CategoryService(), new ProductService()); }
// This method gets called by the runtime. Use this method to add services to the container. public IServiceProvider ConfigureServices(IServiceCollection services) { services.AddDbContext <ApplicationDbContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity <ApplicationUser, IdentityRole>() .AddEntityFrameworkStores <ApplicationDbContext>() .AddDefaultTokenProviders(); services.AddMvc().AddJsonOptions(options => { options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore; }) .AddRazorPagesOptions(options => { options.Conventions.AuthorizeFolder("/Account/Manage"); options.Conventions.AuthorizePage("/Account/Logout"); }); // Register no-op EmailSender used by account confirmation and password reset during development // For more information on how to enable account confirmation and password reset please visit https://go.microsoft.com/fwlink/?LinkID=532713 services.AddSingleton <IEmailSender, EmailSender>(); services.AddSingleton <IProductService, ProductService>(); services.AddSingleton <ICategoryService, CategoryService>(); JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Clear(); services.AddAuthentication(options => { }) .AddJwtBearer(options => { options.TokenValidationParameters = new TokenValidationParameters { ValidateAudience = true, ValidAudience = "worldenderaatrox.com", ValidateIssuer = true, ValidIssuer = "worldenderaatrox.com", ValidateLifetime = true, ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey( Encoding.UTF8.GetBytes("worldenderaatrox00")) }; }); MapperBL.Initialize(); var container = ContainerConfigurator.Configure(services, _logger); return(container.GetInstance <IServiceProvider>()); }
public MovieService(IUow uow, MapperBL mapper) { this.uow = uow; this.mapper = mapper; }
public CommentsService(IUow uow, MapperBL mapper) { this.uow = uow; this.mapper = mapper; }