示例#1
0
 public static void Initialize()
 {
     Resolver.Bind <IControllerFactory>().To <DefaultControllerFactory>();
     Resolver.Bind <IDependencyResolver>().To <MvcControllerResolver>();
     Resolver.Bind <IControllerActivator>().To <ControllerActivator>();
     DependencyResolver.SetResolver(new MvcControllerResolver(DependencyResolver.Current));
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance.
        /// </summary>
        public DomainIoCContainer()
        {
            // Services.
            Resolver.Bind <IFlightService>().To <FlightService>();
            Resolver.Bind <IAirportService>().To <AirportService>();

            //// Mappers.
            Resolver.Bind <IDomainAutoMapper>().To <DomainAutoMapper>();
        }
示例#3
0
 protected override void DoCustomBindings()
 {
     Resolver.Bind <IBindingCreator>().To <BasicBindingCreator>("oracle").SetThreadScope();
     Resolver.Bind <IConfigSetTask>().To <ConfigSetTask>().SetRequestResponseScope().AllowOverride       = false;
     Resolver.Bind <IEnvironmentTasks>().To <EnvironmentTasks>().SetRequestResponseScope().AllowOverride = false;
     Resolver.Bind <IRepositoryFactory>().To <RepositoryFactory>().SetSingletonScope().AllowOverride     = false;
     Resolver.Bind <IUserFacade>().To <UserFacade>().SetRequestResponseScope().AllowOverride             = false;
     Resolver.Bind <ICacheManagementService>().To <CacheManagementService>().SetTransientScope();
     Resolver.Bind <ICacheManagementWrapper>().To <NullCacheManagementWrapper>().SetTransientScope();
     Resolver.Bind <ICacheManagementWrapper>().To <AzureRedisFabricCacheManager>("Azure").SetTransientScope();
 }
示例#4
0
        protected void Application_Start()
        {
            ContainerFactory.BindProviders();
            Resolver.Bind <IConfigurationReader>().To <FileConfigurationReader>();
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();
        }
示例#5
0
        static void MainDependencyResolver()
        {
            Resolver.Bind <ILogger, ConsoleLogger>();
            Resolver.Bind <UserService, UserService>();
            Resolver.Bind <QueryExecutor, QueryExecutor>();
            Resolver.Bind <CommandExecutor, CommandExecutor>();
            Resolver.Bind <CacheService, CacheService>();
            Resolver.Bind <CreateUserHandler, CreateUserHandler>();
            Resolver.Bind <IConnectionFactory>(new SqlConnectionFactory("SQL Connection", Resolver.Get <ILogger>()));
            Resolver.Bind <RestClient>(new RestClient("API_KEY"));

            var createUserHandler = Resolver.Get <CreateUserHandler>();

            createUserHandler.Handle();
            Console.ReadKey();
        }
示例#6
0
 protected override void DoCustomBindings()
 {
     Resolver.Bind <IConfigSetTask>().To <ConfigSetTask>().SetRequestResponseScope().AllowOverride   = false;
     Resolver.Bind <IRepositoryFactory>().To <RepositoryFactory>().SetSingletonScope().AllowOverride = false;
     Resolver.Bind <IUserFacade>().To <UserFacade>().SetRequestResponseScope().AllowOverride         = false;
 }
示例#7
0
 static FlatFileSerializer()
 {
     Resolver.Bind <IFlatFileSerializer>().To <FlatFileSerializerImp>();
     Resolver.Bind <IFlatFileDeserializer>().To <FlatFileDeserializerImp>();
 }
示例#8
0
 protected override void DoCustomBindings()
 {
     Resolver.Bind <IReplaceableSerializer>().To <ProtobufReplaceableSerializer>().SetSingletonScope();
 }