本文整理汇总了C#中IContainer类的典型用法代码示例。如果您正苦于以下问题:C# IContainer类的具体用法?C# IContainer怎么用?C# IContainer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IContainer类属于命名空间,在下文中一共展示了IContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CusCtlTellPanelChar
public CusCtlTellPanelChar(Liplis.MainSystem.Liplis lips, ObjSetting os, string url, string title, string discription, int newsEmotion, int newsPoint, Bitmap charBody, EventHandler enter, IContainer components)
{
this.lips = lips;
this.os = os;
initCms(components);
initDataPanelNonThum(url, title, discription, newsEmotion, newsPoint, charBody, enter);
}
示例2: DesignModeSite
public DesignModeSite (IComponent component, string name, IContainer container, IServiceProvider serviceProvider)
{
_component = component;
_container = container;
_componentName = name;
_serviceProvider = serviceProvider;
}
示例3: Initialize
/// <summary>
/// Base method that initializes the connection on the entity context connection
/// </summary>
public virtual void Initialize(IContainer container)
{
if (EntityContextConfiguration != null)
{
EntityContextConfiguration.Connection.Initialize(container);
}
}
示例4: Detach
public static void Detach(IContainer container)
{
if (Equals(container, Container))
{
Container = null;
}
}
示例5: CloseContainer
/// <summary>
/// Close the Defined Container.
/// </summary>
public void CloseContainer(IContainer containerSource)
{
//TODO: Need Test this Feature. Probably is a Client Packet.
PacketBuilder Builder = new PacketBuilder(0x6F, connection);
Builder.Append(containerSource.Index);
Connection.Send(Builder.GetPacket());
}
示例6: ConfigureApplication
protected override void ConfigureApplication(IContainer container)
{
var viewFactory = container.Resolve<IViewFactory>();
var main = viewFactory.Resolve<LoginViewModel>();
var np = new NavigationPage(main);
_application.MainPage = np;
}
示例7: SilkveilContainerTests
public SilkveilContainerTests()
{
var containerBuilder = new ContainerBuilder();
containerBuilder.Register(typeof(IContainerBinder), typeof(ContainerBinder));
containerBuilder.Register(typeof(IRequestListener), typeof(DownloadRequestListener));
containerBuilder.Register(typeof(IRequestListener), typeof(RedirectRequestListener));
containerBuilder.Register(typeof(IMappingResolver<IDownloadMapping>), typeof(DownloadMappingResolver));
containerBuilder.Register(typeof(IMappingResolver<IRedirectMapping>), typeof(RedirectMappingResolver));
containerBuilder.Register<IMappingProvider<IDownloadMapping>>(
c =>
{
var downloadMappingProvider = new DownloadMappingProvider(c);
downloadMappingProvider.Initialize();
return downloadMappingProvider;
});
containerBuilder.Register<IMappingProvider<IRedirectMapping>>(
c =>
{
var redirectMappingProvider = new RedirectMappingProvider(c);
redirectMappingProvider.Initialize();
return redirectMappingProvider;
});
containerBuilder.Register(typeof(IContentSource), typeof(HttpContentSource));
containerBuilder.Register(typeof(IContentSource), typeof(FileContentSource));
containerBuilder.Register(typeof(IStreamSplitter), typeof(StreamSplitter));
containerBuilder.Register(typeof(IHttpStreamFactory), typeof(HttpStreamFactory));
containerBuilder.Register(typeof(ISilkveilContainer), typeof(SilkveilContainer));
containerBuilder.Register(typeof(IDownloadMapping), typeof(DownloadMapping));
containerBuilder.Register(typeof(IRedirectMapping), typeof(RedirectMapping));
this._container = containerBuilder.Build();
}
示例8: PathResolver
/// <summary>
/// Initializes a new instance of the <see cref="PathResolver"/> class.
/// </summary>
/// <param name="session">The session.</param>
/// <param name="pathData">The path data.</param>
/// <param name="controllerMapper">The controller mapper.</param>
/// <param name="container">The container.</param>
public PathResolver(IDocumentSession session, IPathData pathData, IControllerMapper controllerMapper, IContainer container)
{
_pathData = pathData;
_controllerMapper = controllerMapper;
_container = container;
_session = session;
}
示例9: Application_Start
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
// Register: create and configure the container
_container = BootstrapContainer();
DependencyResolver.SetResolver(new AutofacDependencyResolver(_container));
var builder = new ContainerBuilder();
//var configurationRepository =
// new ConfigurationRepository.ConfigurationRepository() as IConfigurationRepository;
//builder.Register(c => configurationRepository).As<IConfigurationRepository>().SingleInstance();
builder.RegisterType<StashCoreApiConsumer>().As<IStashCoreApiConsumer>();
builder.RegisterType<PullTrackerRepository>().As<IPullTrackerRepository>();
builder.RegisterType<RequestProcessFacade>().As<IRequestProcessFacade>();
IContainer localContainer = builder.Build();
AutofacHelper.Scope = localContainer;
_containerProvider = new ContainerProvider(localContainer);
}
示例10: UsbDs3
public UsbDs3(IContainer container)
: base(USB_CLASS_GUID)
{
container.Add(this);
InitializeComponent();
}
示例11: StructureMapDependencyScope
public StructureMapDependencyScope(IContainer container)
{
if (container == null) {
throw new ArgumentNullException("container");
}
Container = container;
}
示例12: Init
public void Init() {
_settingsA = new ShellSettings { Name = "Alpha" };
_settingsB = new ShellSettings { Name = "Beta", };
_routes = new RouteCollection();
var rootBuilder = new ContainerBuilder();
rootBuilder.Register(ctx => _routes);
rootBuilder.RegisterType<ShellRoute>().InstancePerDependency();
rootBuilder.RegisterType<RunningShellTable>().As<IRunningShellTable>().SingleInstance();
rootBuilder.RegisterModule(new WorkContextModule());
rootBuilder.RegisterType<WorkContextAccessor>().As<IWorkContextAccessor>().InstancePerMatchingLifetimeScope("shell");
rootBuilder.RegisterType<HttpContextAccessor>().As<IHttpContextAccessor>();
rootBuilder.RegisterType<ExtensionManager>().As<IExtensionManager>();
rootBuilder.RegisterType<StubCacheManager>().As<ICacheManager>();
rootBuilder.RegisterType<StubAsyncTokenProvider>().As<IAsyncTokenProvider>();
rootBuilder.RegisterType<StubParallelCacheContext>().As<IParallelCacheContext>();
_rootContainer = rootBuilder.Build();
_containerA = _rootContainer.BeginLifetimeScope(
"shell",
builder => {
builder.Register(ctx => _settingsA);
builder.RegisterType<RoutePublisher>().As<IRoutePublisher>().InstancePerMatchingLifetimeScope("shell");
});
_containerB = _rootContainer.BeginLifetimeScope(
"shell",
builder => {
builder.Register(ctx => _settingsB);
builder.RegisterType<RoutePublisher>().As<IRoutePublisher>().InstancePerMatchingLifetimeScope("shell");
});
}
示例13: Dispose
public void Dispose()
{
if (container != null)
container.Dispose();
container = null;
}
示例14: RegisterContainer
private void RegisterContainer() {
var builder = new ContainerBuilder();
builder.RegisterControllers(Assembly.GetExecutingAssembly());
_pluginServicee.Startup(builder);
_container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(_container));
}
示例15: Init
public static void Init()
{
var serviceBusConnectionString = ConfigurationManager.ConnectionStrings["ServiceBus"].ConnectionString;
var builder = new ContainerBuilder();
var typeProvider = new AssemblyScanningTypeProvider(
Assembly.GetAssembly(typeof(ExampleEventHandler)),
Assembly.GetAssembly(typeof(ExampleCommand))
);
var applicationName = Assembly.GetExecutingAssembly().ToNimbusName();
var instanceName = Environment.MachineName;
builder.RegisterNimbus(typeProvider);
builder.RegisterType<NimbusLogger>().As<ILogger>();
builder.Register(componetContext => new BusBuilder()
.Configure()
.WithConnectionString(serviceBusConnectionString)
.WithNames(applicationName, instanceName)
.WithTypesFrom(typeProvider)
.WithDefaultTimeout(TimeSpan.FromSeconds(30))
.WithAutofacDefaults(componetContext)
.Build())
.As<IBus>()
.AutoActivate()
.OnActivated(o => o.Instance.Start())
.SingleInstance();
_container = builder.Build();
}