当前位置: 首页>>代码示例>>C#>>正文


C# IContainer.Bind方法代码示例

本文整理汇总了C#中IContainer.Bind方法的典型用法代码示例。如果您正苦于以下问题:C# IContainer.Bind方法的具体用法?C# IContainer.Bind怎么用?C# IContainer.Bind使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IContainer的用法示例。


在下文中一共展示了IContainer.Bind方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Initialize

        public override void Initialize(IContainer container)
        {
            container.Bind<IUncommittedEventStreamCoordinator>(UncommittedEventStreamCoordinatorType);

            container.Bind<IEventStore>(EventStoreType, BindingLifecycle.Singleton);

            container.Bind<IEventSubscriptions>(EventSubscriptionsType, BindingLifecycle.Singleton);

            if (EntityContextConfiguration != null)
            {
                EntityContextConfiguration.BindEntityContextTo<IEvent>(container);
                EntityContextConfiguration.BindEntityContextTo<EventSubscription>(container);
                base.Initialize(container);
            }
        }
开发者ID:JoB70,项目名称:Bifrost,代码行数:15,代码来源:EventsConfiguration.cs

示例2: Configure

 Configure(IContainer container)
 {
     SystemName = "[Not Set]";
     container.Bind<IConfigure>(this);
     Container = container;
     InitializeProperties();
 }
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:7,代码来源:Configure.cs

示例3: Initialize

        public void Initialize(IContainer container)
        {
            container.Bind(typeof(ICommandFor<>), (Type t) =>
            {
                var commandForProxies = container.Get<ICommandForProxies>();
                return commandForProxies.CallGenericMethod<object, ICommandForProxies>(cc => cc.GetFor<Bifrost.Commands.Command>, t.GenericTypeArguments[0]);
            });

            var dispatcher = System.Windows.Threading.Dispatcher.CurrentDispatcher;
            Bifrost.Execution.DispatcherManager.Current = new Bifrost.Execution.Dispatcher(dispatcher);
            container.Bind<System.Windows.Threading.Dispatcher>(dispatcher);
            Configure.Instance.Container.Bind<IDispatcher>(Bifrost.Execution.DispatcherManager.Current);

            var proxyGenerator = new ProxyGenerator();
            Configure.Instance.Container.Bind<IProxyBuilder>(proxyGenerator.ProxyBuilder);
            Configure.Instance.Container.Bind(typeof(ICanHandleInvocationsFor<,>), typeof(InvocationHandler<,>));
        }
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:17,代码来源:DesktopConfiguration.cs

示例4: Resolve

 public override void Resolve(IContainer container, Type service)
 {
     var serviceInstanceType = GetServiceInstanceType(service);
     if (serviceInstanceType != null )
     {
         var scope = GetScopeForTarget(serviceInstanceType);
         container.Bind(service,serviceInstanceType, scope);
     }
 }
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:9,代码来源:DefaultConvention.cs

示例5: Initialize

        public override void Initialize(IContainer container)
        {
            if (CommandCoordinatorType != null)
                container.Bind<ICommandCoordinator>(CommandCoordinatorType);

            if (EntityContextConfiguration != null)
            {
                base.Initialize(container);
            }
        }
开发者ID:JoB70,项目名称:Bifrost,代码行数:10,代码来源:CommandsConfiguration.cs

示例6: Initialize

#pragma warning disable 1591 // Xml Comments
        public void Initialize(IContainer container)
        {
            var typeDiscoverer = container.Get<ITypeDiscoverer>();

            var resolverType = typeof(DefaultPrincipalResolver);
            var resolverTypes = typeDiscoverer.FindMultiple<ICanResolvePrincipal>().Where(t => t.Assembly != typeof(SecurityConfiguration).Assembly);
            if (resolverTypes.Count() > 1) throw new MultiplePrincipalResolversFound();
            if (resolverTypes.Count() == 1) resolverType = resolverTypes.First();

            container.Bind<ICanResolvePrincipal>(resolverType);
        }
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:12,代码来源:SecurityConfiguration.cs

示例7: Initialize

#pragma warning disable 1591 // Xml Comments
		public void Initialize(IContainer container)
        {
            container.Bind(container);
#if(!SILVERLIGHT)
            container.Bind<_AppDomain>(AppDomain.CurrentDomain);
            container.Bind<IContractToImplementorsMap>(_contractToImplentorsMap);
#endif
            container.Bind<AssembliesConfiguration>(_assembliesConfiguration);
            container.Bind<IAssemblyProvider>(_assemblyProvider);
            container.Bind<IAssemblies>(typeof(global::Bifrost.Execution.Assemblies), BindingLifecycle.Singleton);
            container.Bind<ITypeDiscoverer>(typeof(TypeDiscoverer), BindingLifecycle.Singleton);
            container.Bind<ITypeFinder>(typeof(TypeFinder), BindingLifecycle.Singleton);
		}
开发者ID:LenFon,项目名称:Bifrost,代码行数:14,代码来源:DefaultBindings.cs

示例8: App

		public App()
		{
            
			Startup += Application_Startup;
			Exit += Application_Exit;
			UnhandledException += Application_UnhandledException;

            var kernel = new StandardKernel();
            Container = new Container(kernel);
            var serviceLocator = new ContainerServiceLocator(Container);
            Container.Bind<IServiceLocator>(serviceLocator);
            ServiceLocator.SetLocatorProvider(() => serviceLocator);
            Container.Bind<ISerializer>(typeof(Serializer));

            var bindings = new DefaultBindings();
            bindings.Initialize(Container);

            var conventions = new DefaultConventions(Container);
            conventions.Initialize();

			InitializeComponent();
		}
开发者ID:sphair,项目名称:Bifrost,代码行数:22,代码来源:App.xaml.cs

示例9: Initialize

		public override void Initialize(IContainer container)
		{
			if( LibrarianType != null )
				container.Bind<ISagaLibrarian>(LibrarianType);


            if (EntityContextConfiguration != null)
            {
                EntityContextConfiguration.BindEntityContextTo<SagaHolder>(container);
                EntityContextConfiguration.BindEntityContextTo<ChapterHolder>(container);
            }

            base.Initialize(container);
		}
开发者ID:LenFon,项目名称:Bifrost,代码行数:14,代码来源:SagasConfiguration.cs

示例10: Configure

        Configure(IContainer container, BindingLifecycle defaultLifecycle,  IDefaultConventions defaultConventions, IDefaultBindings defaultBindings)
        {
            SystemName = "[Not Set]";

            container.DefaultLifecycle = defaultLifecycle;
            container.Bind<IConfigure>(this);

            Container = container;
            ExcludeNamespacesForTypeDiscovery();

            defaultBindings.Initialize(Container);
            defaultConventions.Initialize();
            
            InitializeProperties();
        }
开发者ID:jarlef,项目名称:Bifrost,代码行数:15,代码来源:Configure.cs

示例11: Configure

        Configure(IContainer container, BindingLifecycle defaultObjectLifecycle,  IDefaultConventions defaultConventions, IDefaultBindings defaultBindings)
        {
            DefaultObjectLifecycle = defaultObjectLifecycle;

            container.Bind<IConfigure>(this);

            Container = container;
            ExcludeNamespacesForTypeDiscovery();
            SetupServiceLocator();

            defaultBindings.Initialize(container);
            defaultConventions.Initialize();

            InitializeProperties();
        }
开发者ID:TormodHystad,项目名称:Bifrost,代码行数:15,代码来源:Configure.cs

示例12: Configure

        Configure(IContainer container, BindingLifecycle defaultLifecycle,  IDefaultConventions defaultConventions, IDefaultBindings defaultBindings, AssembliesConfiguration assembliesConfiguration)
        {
            SystemName = "[Not Set]";

            AssembliesConfiguration = assembliesConfiguration;

            container.DefaultLifecycle = defaultLifecycle;
            container.Bind<IConfigure>(this);

            Container = container;

            defaultBindings.Initialize(Container);
            defaultConventions.Initialize();
            
            InitializeProperties();
        }
开发者ID:LenFon,项目名称:Bifrost,代码行数:16,代码来源:Configure.cs

示例13: Initialize

        public void Initialize (IContainer container)
		{
			if( SerializerType != null )
				container.Bind<ISerializer>(SerializerType, BindingLifecycle.Singleton);
		}
开发者ID:JoB70,项目名称:Bifrost,代码行数:5,代码来源:SerializationConfiguration.cs

示例14: Resolve

 public override void Resolve(IContainer container, Type service)
 {
     var proxy = _weaver.GetProxyType(service);
     container.Bind(service,proxy);
 }
开发者ID:sphair,项目名称:Bifrost,代码行数:5,代码来源:ViewModelConvention.cs

示例15: Resolve

		public override void Resolve(IContainer container, Type service)
		{
			var interceptor = container.Get<ResourceInterceptor>();
			var proxy = _proxyGenerator.CreateClassProxy(service, interceptor);
			container.Bind(service,proxy);
        }
开发者ID:JoB70,项目名称:Bifrost,代码行数:6,代码来源:ResourceConvention.cs


注:本文中的IContainer.Bind方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。