public static void RegisterBLLTypes(this IUnityContainer container) { container .RegisterType <UserService>() .RegisterType <CategoryService>() .RegisterType <ItemService>() .RegisterType <ReviewService>() .RegisterInstance <IMapper>(ObjectsMapper.CreateMapper()); //, InstanceLifetime.Singleton }
public static void RegisterBLLTypes(this IUnityContainer container) { container .RegisterType <IAuthenticationService, AuthenticationService>() .RegisterType <IUserService, UserService>() .RegisterType <IRoleService, RoleService>() .RegisterType <IProductService, ProductService>() .RegisterType <IOrderService, OrderService>() .RegisterType <ISupplierService, SupplierService>() .RegisterType <ISuppToProdService, SuppToProdService>() .RegisterInstance <IMapper>(ObjectsMapper.CreateMapper()); //, InstanceLifetime.Singleton }
public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); services.Configure <MongoConfiguration>( Configuration.GetSection(nameof(MongoConfiguration))); services.AddSingleton <IMongoConfig>(sp => sp.GetRequiredService <IOptions <MongoConfiguration> >().Value); services.AddTransient <IMongoContext, MongoContext>(); services.AddSingleton <IMapper>(ObjectsMapper.CreateMapper()); services.AddTransient <IPostService, PostService>(); services.AddTransient <IArtistService, ArtistService>(); services.AddControllers(); services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(options => { options.LoginPath = new Microsoft.AspNetCore.Http.PathString("/Account/Login"); }); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllersWithViews(); //Mongo Configuration Dependency Injection services.Configure <MongoConfiguration>( Configuration.GetSection(nameof(MongoConfiguration))); services.AddSingleton <IMongoConfiguration>(sp => sp.GetRequiredService <IOptions <MongoConfiguration> >().Value); services.AddTransient <IMongoContext, MongoContext>(); //Neo4j Configuration Dependency Injection services.Configure <Neo4jConfiguration>( Configuration.GetSection(nameof(Neo4jConfiguration))); services.AddSingleton <INeo4jConfiguration>(sp => sp.GetRequiredService <IOptions <Neo4jConfiguration> >().Value); services.AddTransient <INeo4jContext, Neo4jContext>(); // BLL Mapper Dependency Injection services.AddSingleton <IMapper>(ObjectsMapper.CreateMapper()); // Services Dependency Injection services.AddTransient <IPostService, PostService>(); services.AddTransient <IUserService, UserService>(); services.AddTransient <IPersonService, PersonService>(); // Controllers Dependency Injection services.AddControllers(); // //services.Configure<IdentityOptions>(options => //{ // // Password settings. // options.Password.RequiredUniqueChars = 1; // // Lockout settings. // options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromMinutes(5); // options.Lockout.MaxFailedAccessAttempts = 5; // options.Lockout.AllowedForNewUsers = true; // // User settings. // options.User.AllowedUserNameCharacters = // "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@+"; // options.User.RequireUniqueEmail = true; //}); //services.ConfigureApplicationCookie(options => //{ // // Cookie settings // options.Cookie.HttpOnly = true; // options.ExpireTimeSpan = TimeSpan.FromMinutes(5); // options.LoginPath = "/Account/Login"; // options.AccessDeniedPath = "/Account/AccessDenied"; // options.SlidingExpiration = true; //}); services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie(options => //CookieAuthenticationOptions { options.LoginPath = new Microsoft.AspNetCore.Http.PathString("/Account/Login"); }); }