Exemple #1
0
        protected override void Load(ContainerBuilder builder)
        {
            var smartDbContext = new SmartBloggerDbContext(SmartBloggerTestsConsts.connectionString);

            var blogRepository = new BlogRepository(smartDbContext);

            builder.RegisterType <BlogRepository>()
            .As <IBlogRepository>()
            .WithParameter("context", smartDbContext)
            .SingleInstance();

            builder.RegisterType <BlogService>()
            .As <IBlogService>()
            .WithParameter("blogRepository", blogRepository)
            .SingleInstance();
        }
        protected override void Load(ContainerBuilder builder)
        {
            var smartDbContext = new SmartBloggerDbContext(_connectionString);

            builder.RegisterType <BlogRepository>()
            .As <IBlogRepository>()
            .WithParameter("context", smartDbContext)
            .SingleInstance();

            builder.RegisterType <BlogService>()
            .As <IBlogService>()
            .SingleInstance();

            builder.RegisterType <CloudBlobStorageService>()
            .As <ICloudBlobStorageService>()
            .SingleInstance();
        }
Exemple #3
0
 public BlogRepository(SmartBloggerDbContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }