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


C# IKernel.Resolve方法代码示例

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


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

示例1: CreateNotificationEndPoint

        private static INotificationEndPoint CreateNotificationEndPoint(IKernel kernel)
        {
            var cloudMediaContext = kernel.Resolve<CloudMediaContext>();
            var cloudQueueClient = kernel.Resolve<CloudQueueClient>();

            try
            {
                // ReSharper disable once ReplaceWithSingleCallToFirstOrDefault
                INotificationEndPoint endpoint = cloudMediaContext.NotificationEndPoints
                                                                   .Where(ep => ep.Name == UploadConfig.NotificationQueueName)
                                                                   .FirstOrDefault();
                if (endpoint != null)
                    return endpoint;

                // Make sure the queue exists in Azure Storage
                var notificationQueue = cloudQueueClient.GetQueueReference(UploadConfig.NotificationQueueName);
                notificationQueue.CreateIfNotExists();

                // Create the endpoint
                return cloudMediaContext.NotificationEndPoints.Create(UploadConfig.NotificationQueueName, NotificationEndPointType.AzureQueue,
                                                                       UploadConfig.NotificationQueueName);
            }
            finally
            {
                kernel.ReleaseComponent(cloudMediaContext);
                kernel.ReleaseComponent(cloudQueueClient);
            }
        }
开发者ID:rustyrazorblade,项目名称:killrvideo-csharp,代码行数:28,代码来源:UploadsWorkerWindsorInstaller.cs

示例2: Resolve

			public override object Resolve(IKernel kernel)
			{
				string key = null;
				var argument = arguments[0];

				if (arguments.Length == 2)
				{
					key = (string)argument;
					argument = arguments[1];
				}
				else if (argument is string)
				{
					return kernel.Resolve((string)argument, ComponentType);
				}

				if (argument is Uri)
				{
					argument = WcfEndpoint.At((Uri)argument);
				}

				var args = new HybridDictionary { { Guid.NewGuid().ToString(), argument } };

				if (key == null)
				{
					return kernel.Resolve(ComponentType, args);
				}

				return kernel.Resolve(key, ComponentType, args);
			}
开发者ID:ramonsmits,项目名称:Castle.Facilities.Wcf,代码行数:29,代码来源:WcfClientFactorySelector.cs

示例3: Resolve

		/// <summary>
		///   Resolves the component(s) from given kernel.
		/// </summary>
		/// <param name = "kernel"></param>
		/// <returns>Resolved component(s).</returns>
		public virtual object Resolve(IKernel kernel)
		{
			if (string.IsNullOrEmpty(ComponentName) == false && kernel.HasComponent(ComponentName))
			{
				if (ComponentType == null)
				{
					return kernel.Resolve(ComponentName, AdditionalArguments);
				}

				return kernel.Resolve(ComponentName, ComponentType, AdditionalArguments);
			}

			return kernel.Resolve(ComponentType, AdditionalArguments);
		}
开发者ID:7digital,项目名称:Castle.Windsor,代码行数:19,代码来源:TypedFactoryComponent.cs

示例4: Create

 private ICustomFieldManager Create(IKernel kernel, CreationContext context)
 {
     if (context.Handler.ComponentModel.Name == typeof(PublicController).FullName
         || context.Handler.ComponentModel.Name == typeof(DataFileController).FullName
         || context.Handler.ComponentModel.Name == typeof(CustomFieldController).FullName)
     {
         return kernel.Resolve<PublicFieldManager>();
     }
     else if (context.Handler.ComponentModel.Name == typeof(PrivateHealthController).FullName)
     {
         return kernel.Resolve<PrivateHealthFieldManager>();
     }
     throw new InvalidOperationException(string.Format("Cannot resolve {0} using given {1}.", typeof(ICustomFieldManager).Name, context.GetType().Name));
 }
开发者ID:modulexcite,项目名称:StudentSuccessDashboard,代码行数:14,代码来源:BusinessLogicInstaller.cs

示例5: Create

 public static IFileProcessor Create(IKernel kernel, string typeKey)
 {
     var blobClient = kernel.Resolve<IBlobClient>();
     var repositories = kernel.Resolve<IRepositoryContainer>();
     if (typeKey == "ServiceOffering")
     {
         return new ServiceOfferingFileProcessor(blobClient, repositories);
     }
     else if (typeKey == "ServiceAttendance")
     {
         return new ServiceAttendanceFileProcessor(blobClient, repositories);
     }
     return null;
 }
开发者ID:modulexcite,项目名称:StudentSuccessDashboard,代码行数:14,代码来源:FileProcessorFactory.cs

示例6: Execute

 public IResponse Execute(IKernel kernel, IRequest request, RouteBase route)
 {
     // This is kind of nasty and needs to be smarter as well as handling bound models
     var controller = (SammyController)kernel.Resolve(route.Type);
     controller.Request = new Request(request);
     return (IResponse)route.Method.Invoke(controller, null);
 }
开发者ID:davidmohara,项目名称:Sammy,代码行数:7,代码来源:ControllerInvoker.cs

示例7: RegisterIMappingEngine

 private void RegisterIMappingEngine(IKernel kernel)
 {
     kernel.Register(
         Component.For<IMappingEngine>()
             .UsingFactoryMethod(k => new MappingEngine(kernel.Resolve<IConfigurationProvider>()))
     );
 }
开发者ID:bhaktapk,项目名称:com-prerit,代码行数:7,代码来源:AutoMapperRegistration.cs

示例8: GetAzureServiceConfig

        private static IMicrosoftStorageConfig GetAzureServiceConfig(IKernel k, ComponentModel cm, CreationContext cc)
        {
            var serviceConfig = new DefaultAzureServiceConfigurationProvider(k.Resolve<IAppConfigSettings>()).GetConfigRaw();
            var webConfig = serviceConfig["Web"];

            return new DictionaryAdapterFactory().GetAdapter<IMicrosoftStorageConfig>(webConfig);
        }
开发者ID:ognyandim,项目名称:AzureStrongConfig,代码行数:7,代码来源:ContainerRegistrar.cs

示例9: CreateAspects

 public IList<IAspect> CreateAspects(IKernel kernel)
 {
     List<IAspect> result = new List<IAspect>();
     foreach(String id in AspectComponents.Keys) {
         result.Add((IAspect) kernel.Resolve(id, typeof(IAspect )));
     }
     return result;
 }
开发者ID:mbsky,项目名称:dotnetmarcheproject,代码行数:8,代码来源:AdviceHandler.cs

示例10: ProcessModel

		public override void ProcessModel(IKernel kernel, ComponentModel model)
		{
			if (model.Service is IBehaviorStore)
			{
				foreach (var node in kernel.GraphNodes.OfType<ComponentModel>())
				{
					SetProxyInformation(node, kernel.Resolve<IBehaviorConfigurator>());
				}
				return;
			}

			if (!kernel.HasComponent(typeof (IBehaviorStore))) return;
			var behaviorToProxyResolver = kernel.Resolve<IBehaviorConfigurator>();

			//Get the proxy info
			SetProxyInformation(model, behaviorToProxyResolver);
		}
开发者ID:Mrding,项目名称:Ribbon,代码行数:17,代码来源:BehaviorInspector.cs

示例11: CreateCloudQueueClient

        private static CloudQueueClient CreateCloudQueueClient(IKernel kernel)
        {
            var storageAccount = kernel.Resolve<CloudStorageAccount>();
            CloudQueueClient client = storageAccount.CreateCloudQueueClient();
            kernel.ReleaseComponent(storageAccount);

            return client;
        }
开发者ID:rustyrazorblade,项目名称:killrvideo-csharp,代码行数:8,代码来源:UploadsWorkerWindsorInstaller.cs

示例12: ConfigureCache

 private void ConfigureCache(IKernel kernel, IEducationContext instance)
 {
     if (EnableCaching)
     {
         instance.Cache = kernel.Resolve<ICache>();
         instance.CachingPolicy = CachingPolicy.CacheAll;
     }
 }
开发者ID:modulexcite,项目名称:StudentSuccessDashboard,代码行数:8,代码来源:DataContextConfigurator.cs

示例13: CreateLeaseManagerConfig

        private static LeaseManagerConfig CreateLeaseManagerConfig(IKernel kernel)
        {
            // Configure the lease manager
            var configRetriever = kernel.Resolve<IGetEnvironmentConfiguration>();
            var leaseManagerConfig = new LeaseManagerConfig { LeaseName = "SampleDataJobs", UniqueId = configRetriever.UniqueInstanceId };
            kernel.ReleaseComponent(configRetriever);

            return leaseManagerConfig;
        }
开发者ID:rustyrazorblade,项目名称:killrvideo-csharp,代码行数:9,代码来源:SampleDataWorkerWindsorInstaller.cs

示例14: ContainerContext

        public ContainerContext(IKernel kernel)
        {
            this.kernel = kernel;

            EnsureContainerContextStoreRegistered();

            contextStore = kernel.Resolve<IContainerContextStore>();
            contextStore.RegisterCurrent(this);
        }
开发者ID:Natsui31,项目名称:keyhub,代码行数:9,代码来源:ContainerContext.cs

示例15: CreateCloudStorageAccount

        private static CloudStorageAccount CreateCloudStorageAccount(IKernel kernel)
        {
            // Get Azure configurations
            var configRetriever = kernel.Resolve<IGetEnvironmentConfiguration>();
            string storageConnectionString = configRetriever.GetSetting(StorageConnectionStringAppSettingsKey);
            kernel.ReleaseComponent(configRetriever);

            return CloudStorageAccount.Parse(storageConnectionString);
        }
开发者ID:rustyrazorblade,项目名称:killrvideo-csharp,代码行数:9,代码来源:UploadsWorkerWindsorInstaller.cs


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