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


C# IContainer.Get方法代码示例

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


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

示例1: App

 static App()
 {
     _container = ContainerContext.Current;
     _container.Register<IMessenger>(new Messenger());
     ViewModelService.TypeFinder = (name) => {
         var typeDiscoverer = _container.Get<ITypeDiscoverer>();
         var types = typeDiscoverer.FindAnyByName(name);
         if (types.Length > 1) throw new ArgumentException("Ambiguous viewModel name");
         return types[0];
     };
     ViewModelService.InstanceCreator = (t) => _container.Get(t);
 }
开发者ID:dcr25568,项目名称:SignalR_Blueprints,代码行数:12,代码来源:App.xaml.cs

示例2: Configure

        public void Configure(IContainer container)
        {
            var basicApiProvider = container.Get<IBasicApiProvider>();
            var registry = container.Get<IRegistry>();
            registry.Config = basicApiProvider.GetDefaultUaConfig();
            registry.LoggingConfig = basicApiProvider.GetDefaultLoggingConfig();
            registry.MediaConfig = container.Get<IMediaApiProvider>().GetDefaultConfig();

            container.RegisterAsSingleton(registry.LoggingConfig);
            container.RegisterAsSingleton(registry.Config);
            container.RegisterAsSingleton(registry.MediaConfig);

            container.RegisterAsSingleton<ISipUserAgent, ISipUserAgentInternal, DefaultSipUserAgent>();
        }
开发者ID:percramer,项目名称:pjsip4net,代码行数:14,代码来源:DefaultAgentConfigurator.cs

示例3: Configure

        public void Configure(IContainer container)
        {
            Helper.GuardNotNull(container);
            container.RegisterAsSingleton<IObjectFactory, DefaultObjectFactory>();
            container.RegisterAsSingleton<ILocalRegistry, DefaultLocalRegistry>();
            container.RegisterAsSingleton(container.Get<ILocalRegistry>() as IConfigurationContext);

            container.RegisterAsSingleton<IImManager, DefaultImManager>();
            container.RegisterAsSingleton(container.Get<IImManager>().As<IImManagerInternal>());
            container.Register<IMessageBuilder, DefaultMessageBuilder>();
            container.Register<IBuddyBuilder, DefaultBuddyBuilder>();
            container.Register<IBuddyInternal, Buddy>();

            container.RegisterAsSingleton<ISipUserAgent, DefaultSipUserAgent>();
            container.RegisterAsSingleton(container.Get<ISipUserAgent>() as ISipUserAgentInternal);
        }
开发者ID:kumarkmmca,项目名称:pjsip4net,代码行数:16,代码来源:DefaultComponentConfigurator.cs

示例4: GeneratedProxies

        public GeneratedProxies(
            CommandProxies commandProxies,
            CommandSecurityProxies commandSecurityProxies,
            QueryProxies queryProxies,
            ReadModelProxies readModelProxies,
            ServiceProxies serviceProxies,
            NamespaceConfigurationProxies namespaceConfigurationProxies,
            ITypeDiscoverer typeDiscoverer,
            IContainer container)
        {
            var builder = new StringBuilder();
            builder.Append(commandProxies.Generate());
            builder.Append(commandSecurityProxies.Generate());
            builder.Append(readModelProxies.Generate());
            builder.Append(queryProxies.Generate());
            builder.Append(serviceProxies.Generate());
            builder.Append(namespaceConfigurationProxies.Generate());

            var generatorTypes = typeDiscoverer.FindMultiple<IProxyGenerator>().Where(t => !t.Namespace.StartsWith("Bifrost"));
            foreach (var generatorType in generatorTypes)
            {
                var generator = container.Get(generatorType) as IProxyGenerator;
                builder.Append(generator.Generate());
            }

            All = builder.ToString();
        }
开发者ID:jarlef,项目名称:Bifrost,代码行数:27,代码来源:GeneratedProxies.cs

示例5: Initialize

 public void Initialize(IContainer container)
 {
     var typeDiscoverer = container.Get<ITypeDiscoverer>();
     FluentConfiguration.Mappings(m => DiscoverClassMapsAndAddAssemblies(typeDiscoverer, m));
     Configuration = FluentConfiguration.BuildConfiguration();
     SessionFactory = Configuration.BuildSessionFactory();
 }
开发者ID:JoB70,项目名称:Bifrost,代码行数:7,代码来源:EntityContextConnection.cs

示例6: Main

		public static void Main (string[] args)
		{
		    var kernel = new StandardKernel();
		    Container = new Container(kernel);

		    Configure.With(Container)
                .UsingJsonStorage("JsonDB")
                .Initialize();

		    var commandCoordinator = ServiceLocator.Current.GetInstance<ICommandCoordinator>();

			var command = new CreatePerson(Guid.NewGuid(), "First", "Person");
			var result = commandCoordinator.Handle(command);
			if (!result.Success)
			{
				Console.WriteLine("Handling of command failed");
				Console.WriteLine("Exception : {0}\nStack Trace : {1}", result.Exception.Message, result.Exception.StackTrace);
			}

			var queries = Container.Get<IPersonView>();
			var persons = queries.GetAll();
			foreach (var person in persons)
			{
				Console.WriteLine("Person ({0}) - {1} {2}", person.Id, person.FirstName, person.LastName);
			}
		}
开发者ID:TormodHystad,项目名称:Bifrost,代码行数:26,代码来源:Main.cs

示例7: Configure

 public void Configure(IContainer container)
 {
     Helper.GuardNotNull(container);
     container.RegisterAsSingleton<IAccountManager, DefaultAccountManager>();
     container.RegisterAsSingleton(container.Get<IAccountManager>() as IAccountManagerInternal);
     container.Register<IAccountBuilder, DefaultAccountBuilder>();
     container.Register<IAccountInternal, Account>();
 }
开发者ID:kumarkmmca,项目名称:pjsip4net,代码行数:8,代码来源:DefaultAccountComponentConfigurator.cs

示例8: DiscoverAssembliesWithHbmMappings

 static IList<Assembly> DiscoverAssembliesWithHbmMappings(IContainer container)
 {
     return container
         .Get<IAssemblies>()
         .GetAll()
         .Where(a => a.GetManifestResourceNames().Any(s => s.EndsWith(".hbm.xml")))
         .ToList();
 }
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:8,代码来源:EntityContextConnection.cs

示例9: Configure

 public void Configure(IContainer container)
 {
     Helper.GuardNotNull(container);
     container.RegisterAsSingleton<ICallManager, DefaultCallManager>();
     container.RegisterAsSingleton(container.Get<ICallManager>() as ICallManagerInternal);
     container.Register<ICallBuilder, DefaultCallBuilder>();
     container.Register<ICallInternal, Call>();
 }
开发者ID:kumarkmmca,项目名称:pjsip4net,代码行数:8,代码来源:DefaultCallComponentConfigurator.cs

示例10: Configure

 public void Configure(IContainer container)
 {
     Helper.GuardNotNull(container);
     container.RegisterAsSingleton<IConferenceBridge, DefaultConferenceBridge>();
     container.RegisterAsSingleton<IMediaManager, DefaultMediaManager>();
     container.RegisterAsSingleton(container.Get<IMediaManager>() as IMediaManagerInternal);
     container.Register<CodecInfo, CodecInfo>();
     container.Register<IWavPlayer, WavPlayer>();
 }
开发者ID:kumarkmmca,项目名称:pjsip4net,代码行数:9,代码来源:DefaultMediaComponentConfigurator.cs

示例11: UIPort

        public UIPort(IContainer container, ScrollViewer scrollViewer, StackPanel mainStack)
        {
            _container = container;
            _normalMode = _container.Get<IHasNormalMode>();

            _mainStack = mainStack;

            _stackPanelWrapper = new StackPanelWrapper(mainStack, scrollViewer, false);
        }
开发者ID:mcwatt77,项目名称:vimcontrols,代码行数:9,代码来源:UIPort.cs

示例12: DiscoverAssembliesWithFluentMappings

 static IList<Assembly> DiscoverAssembliesWithFluentMappings(IContainer container)
 {
     return container
         .Get<IImplementorFinder>()
         .GetImplementorsFor(typeof(IMappingProvider))
         .Select(t => t.Assembly)
         .Distinct()
         .ToList();
 }
开发者ID:ProCoSys,项目名称:Bifrost,代码行数:9,代码来源:EntityContextConnection.cs

示例13: 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

示例14: 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

示例15: NoteCollection

        public NoteCollection(IContainer container)
        {
            _container = container;
            #if DEBUG
            var file = new FileInfo(@"..\..\notes.xml");
            #else
            var file = new FileInfo("notes.xml");
            #endif

            _document = file.Exists
                            ? XDocument.Load(file.FullName)
                            : new XDocument(new XElement("notes"));

            _children = _document
                .Elements("notes")
                .Single()
                .Elements("note")
                .Select(noteElement => (object) _container.Get<NoteItem>(noteElement))
                .ToArray();
        }
开发者ID:mcwatt77,项目名称:vimcontrols,代码行数:20,代码来源:NoteCollection.cs


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