/// <summary>
 /// In normal circumstances, use the cached repository.
 /// Inside the cached repository class, we need the real repository.
 /// Consumer does not have to worry, still calls the Resolver.Get method.
 /// Real repository does not have to be concerned about caching logic.
 /// </summary>
 internal static void BindRepositoryWithCache <TInterface, TRepository, TCachedRepository>(this NinjectModule ninjectModule)
     where TRepository : TInterface
     where TCachedRepository : TInterface
 {
     ninjectModule.Bind <TInterface>().To <TRepository>().WhenInjectedExactlyInto <TCachedRepository>();
     ninjectModule.Bind <TInterface>().To <TCachedRepository>();
 }
Пример #2
0
 public static void BindBusinesses(this NinjectModule iocModule)
 {
     iocModule.Bind(typeof(IGenericBusiness <,>)).To(typeof(GenericBusiness <,>));
     iocModule.Bind <IProductoBusiness>().To <ProductoBusiness>();
     iocModule.Bind <IPedidoBusiness>().To <PedidoBusiness>();
     iocModule.Bind <IClienteBusiness>().To <ClienteBusiness>();
 }
Пример #3
0
 public static void BindBusinessesNamedScoped(this NinjectModule iocModule, string NamedScope)
 {
     iocModule.Bind(typeof(IGenericBusiness <,>)).To(typeof(GenericBusiness <,>)).InNamedScope(NamedScope);
     iocModule.Bind <IProductoBusiness>().To <ProductoBusiness>().InNamedScope(NamedScope);
     iocModule.Bind <IPedidoBusiness>().To <PedidoBusiness>().InNamedScope(NamedScope);
     iocModule.Bind <IClienteBusiness>().To <ClienteBusiness>().InNamedScope(NamedScope);
     iocModule.Bind <IPaisBusiness>().To <PaisBusiness>().InNamedScope(NamedScope);
 }
        public static void AddHttpRestClient <TService, TImplementation>(this NinjectModule module, string httpClientName, Action <HttpClient> configureHttpClient)
            where TService : class
            where TImplementation : class, TService
        {
            module
            .Bind <TService>()
            .To <TImplementation>();

            module
            .Bind <IHttpRestClient>()
            .To <HttpRestClient>()
            .WhenInjectedInto(typeof(TImplementation))
            .WithConstructorArgument("name", httpClientName)
            .WithConstructorArgument("configureHttpClient", configureHttpClient);
        }
Пример #5
0
        /// <summary>
        /// Registers an object for navigation.
        /// </summary>
        /// <typeparam name="T">The Type of the object to register</typeparam>
        /// <param name="ninjectModule"><see cref="NinjectModule"/> used to register type for Navigation.</param>
        /// <param name="name">The unique name to register with the object.</param>
        public static void RegisterTypeForNavigation <T>(this NinjectModule ninjectModule, string name = null)
        {
            Type   type     = typeof(T);
            string viewName = string.IsNullOrWhiteSpace(name) ? type.Name : name;

            ninjectModule.Bind <object>().To <T>().Named(viewName);
        }
 public static void AddHttpRestClientFactory(this NinjectModule module)
 {
     module
     .Bind <IHttpRestClientFactory>()
     .To <HttpRestClientFactory>()
     .InSingletonScope();
 }
Пример #7
0
 public static void BindDAL(this NinjectModule iocModule)
 {
     iocModule.Bind(typeof(IRepository <,>)).To(typeof(NHibernateRepository <,>));
 }
Пример #8
0
        public static void BindMapper(this NinjectModule module, Action <IMapperConfigurationExpression> mapperConfiguration)
        {
            var mapperCfg = new MapperConfiguration(mapperConfiguration);

            module.Bind <IMapper>().ToMethod(x => mapperCfg.CreateMapper()).InThreadScope();
        }
Пример #9
0
 public void LoadBindings(NinjectModule module)
 {
     module.Bind <IMetaDataLogic>().To <MetaDataLogic>().InSingletonScope();
     module.Bind <IMetaDataScriptedFragment>().To <MetaDataScriptedFragment>().InSingletonScope();
 }
Пример #10
0
 public static void RegisterDeactivator <TDeactivator>(this NinjectModule source)
     where TDeactivator : IDeactivateable
 {
     source.Bind <IDeactivateable>().To <TDeactivator>();
 }
 internal static void BindRepositoryWithCache(this NinjectModule ninjectModule, Type interfaceType, Type repositoryType, Type cachedRepositoryType)
 {
     ninjectModule.Bind(interfaceType).To(repositoryType).WhenInjectedExactlyInto(cachedRepositoryType);
     ninjectModule.Bind(interfaceType).To(cachedRepositoryType);
 }
 public void LoadBindings(NinjectModule module)
 {
     module.Bind <IEmoticonLogic>().To <EmoticonLogic>().InSingletonScope();
 }
 public void LoadBindings(NinjectModule module)
 {
     module.Bind <IUserHealth>().To <UserHealth>();
 }
Пример #14
0
 public void LoadBindings(NinjectModule module)
 {
     module.Bind <ISplashLogic>().To <SplashLogic>().InSingletonScope();
 }