BgEngine.DependencyResolution.IoC.Initialize C# (CSharp) Method

Initialize() public static method

Initialize mappings
public static Initialize ( ) : IContainer
return IContainer
        public static IContainer Initialize()
        {
            ObjectFactory.Initialize(x =>
                        {
                            x.Scan(scan =>
                                    {
                                        scan.TheCallingAssembly();
                                        scan.WithDefaultConventions();
                                    });
                            // Service dependencies
                            x.For<IBlogServices>().HttpContextScoped().Use<BlogServices>();
                            x.For<IAccountServices>().HttpContextScoped().Use<AccountServices>();
                            x.For<IMediaServices>().HttpContextScoped().Use<MediaServices>();
                            x.For<IStatsServices>().HttpContextScoped().Use<StatsServices>();
                            x.For<ISubscriptionServices>().HttpContextScoped().Use<SubscriptionServices>();
                            x.For<INewsletterServices>().HttpContextScoped().Use<NewsletterServices>();
                            x.For<IService<Category>>().HttpContextScoped().Use<Service<Category>>();
                            x.For<IService<Rating>>().HttpContextScoped().Use<Service<Rating>>();
                            x.For<IService<Image>>().HttpContextScoped().Use<Service<Image>>();
                            x.For<IService<Album>>().HttpContextScoped().Use<Service<Album>>();
                            x.For<IService<User>>().HttpContextScoped().Use<Service<User>>();
                            x.For<IService<Role>>().HttpContextScoped().Use<Service<Role>>();
                            x.For<IService<Tag>>().HttpContextScoped().Use<Service<Tag>>();
                            x.For<IService<Video>>().HttpContextScoped().Use<Service<Video>>();
                            x.For<IService<Post>>().HttpContextScoped().Use<Service<Post>>();
                            x.For<IService<Comment>>().HttpContextScoped().Use<Service<Comment>>();
                            x.For<IService<Rating>>().HttpContextScoped().Use<Service<Rating>>();
                            //Unit of work dependencies
                            x.For<IBlogUnitOfWork>().HttpContextScoped().Use<BlogUnitOfWork>();
                            //Repository dependencies
                            x.For<IPostRepository>().HttpContextScoped().Use<PostRepository>();
                            x.For<ICategoryRepository>().HttpContextScoped().Use<CategoryRepository>();
                            x.For<IImageRepository>().HttpContextScoped().Use<ImageRepository>();
                            x.For<ICommentRepository>().HttpContextScoped().Use<CommentRepository>();
                            x.For<IAlbumRepository>().HttpContextScoped().Use<AlbumRepository>();
                            x.For<IRepository<Album>>().HttpContextScoped().Use<AlbumRepository>();
                            x.For<IRepository<Image>>().HttpContextScoped().Use<ImageRepository>();
                            x.For<IVideoRepository>().HttpContextScoped().Use<VideoRepository>();
                            x.For<ITagRepository>().HttpContextScoped().Use<TagRepository>();
                            x.For<IRepository<User>>().HttpContextScoped().Use<Repository<User>>();
                            x.For<IRepository<Subscription>>().HttpContextScoped().Use<Repository<Subscription>>();
                            x.For<INewsletterRepository>().HttpContextScoped().Use<NewsletterRepository>();
                            x.For<IRepository<Newsletter>>().HttpContextScoped().Use<Repository<Newsletter>>();
                            x.For<IRepository<Post>>().HttpContextScoped().Use<PostRepository>();
                            x.For<IRepository<Comment>>().HttpContextScoped().Use<CommentRepository>();
                            x.For<IRepository<Category>>().HttpContextScoped().Use<CategoryRepository>();
                            x.For<IRepository<Role>>().HttpContextScoped().Use<Repository<Role>>();
                            x.For<IRepository<Tag>>().HttpContextScoped().Use<TagRepository>();
                            x.For<IRepository<Rating>>().HttpContextScoped().Use<Repository<Rating>>();
                            x.For<IRepository<Video>>().HttpContextScoped().Use<VideoRepository>();
                            x.For<IRepository<BlogResource>>().HttpContextScoped().Use<Repository<BlogResource>>();
                            //Database initialization dependencies
                            //You can change between:
                            //  - ModelContextInit (Create empty database wit admin user and roles)
                            //  - TestModelContextInit (Create database with test data)
                            x.For<IDatabaseInitializer<BlogUnitOfWork>>().HttpContextScoped().Use<TestModelContextInit>();
                            //Initialize validator
                            x.For<IEntityValidator>().HttpContextScoped().Use<EntityValidator>();
                            //Resources
                            x.For<IBlogResourceServices>().HttpContextScoped().Use<BlogResourceServices>();
                        });
            return ObjectFactory.Container;
        }