-
Notifications
You must be signed in to change notification settings - Fork 2
/
PersistanceModule.cs
36 lines (30 loc) · 1.45 KB
/
PersistanceModule.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using Ninject;
using Ninject.Modules;
using StaticVoid.Repository;
namespace StaticVoid.Blog.Data
{
public class PersistanceModule : NinjectModule
{
public override void Load()
{
Bind(typeof(IRepositoryDataSource<>)).To(typeof(DbContextRepositoryDataSource<>));
Bind(typeof(IRepository<>)).To(typeof(SimpleRepository<>));
Bind(typeof(IAttacher<>)).To(typeof(EntityFrameworkAttacher<>));
Bind<ICachedBlogRepositoryStorage>().To<CachedBlogRepositoryStorage>().InSingletonScope();
Rebind<IRepository<Data.Blog>>().To<CachedBlogRepository>();
Bind<ICachedPostRepositoryStorage>().To<CachedPostRepositoryStorage>().InSingletonScope();
Rebind<IRepository<Data.Post>>().To<CachedPostRepository>();
Bind<ICachedUserRepositoryStorage>().To<CachedUserRepositoryStorage>().InSingletonScope();
Rebind<IRepository<Data.User>>().To<CachedUserRepository>();
Bind<ICachedRedirectRepositoryStorage>().To<CachedRedirectRepositoryStorage>().InSingletonScope();
Rebind<IRepository<Data.Redirect>>().To<CachedRedirectRepository>();
Bind<ICachedBlogTemplateRepositoryStorage>().To<CachedBlogTemplateRepositoryStorage>().InSingletonScope();
Rebind<IRepository<Data.BlogTemplate>>().To<CachedBlogTemplateRepository>();
}
}
}