本文整理汇总了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);
}
}
示例2: Configure
Configure(IContainer container)
{
SystemName = "[Not Set]";
container.Bind<IConfigure>(this);
Container = container;
InitializeProperties();
}
示例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<,>));
}
示例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);
}
}
示例5: Initialize
public override void Initialize(IContainer container)
{
if (CommandCoordinatorType != null)
container.Bind<ICommandCoordinator>(CommandCoordinatorType);
if (EntityContextConfiguration != null)
{
base.Initialize(container);
}
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例13: Initialize
public void Initialize (IContainer container)
{
if( SerializerType != null )
container.Bind<ISerializer>(SerializerType, BindingLifecycle.Singleton);
}
示例14: Resolve
public override void Resolve(IContainer container, Type service)
{
var proxy = _weaver.GetProxyType(service);
container.Bind(service,proxy);
}
示例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);
}