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


C# IObjectFactory.Resolve方法代码示例

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


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

示例1: Initialize

        public void Initialize(IObjectFactory factory)
        {
            if (!LogCommands)
                return;
            factory.RegisterTypes(new[] { typeof(ProcessingCommandsIntercepter), typeof(RestCommandsIntercepter) });
            var processingInterceptor = factory.Resolve<ProcessingCommandsIntercepter>();
            var restInterceptor = factory.Resolve<RestCommandsIntercepter>();
            var aspectRegistrator = factory.Resolve<IAspectRegistrator>();

            var tpe = typeof(IProcessingEngine);
            var tcc = typeof(ICommandConverter);
            var tre = typeof(IRestApplication);
            aspectRegistrator.Before(
                tpe,
                tpe.GetMethod("Execute"),
                (e, args) => processingInterceptor.LogCommands((dynamic)(args[0])));
            aspectRegistrator.Around(
                tcc,
                tcc.GetMethod("PassThrough"),
                (e, args, baseCall) => restInterceptor.PassThrough(args, baseCall));
            aspectRegistrator.Around<IRestApplication, Stream>(
                r => r.Get(),
                restInterceptor.Get);
            aspectRegistrator.Around<IRestApplication, Stream, Stream>(
                r => r.Post(null),
                (_, s, bc) => restInterceptor.Post(s, bc));
        }
开发者ID:rinmalavi,项目名称:revenj,代码行数:27,代码来源:Configuration.cs

示例2: Start

 public static IDomainModel Start(IObjectFactory factory)
 {
     var init = factory.Resolve<SystemInitialization>();
     init.Initialize(false);
     //TODO change domain model boot. export to ISystemAspect to avoid explicit initialization
     return factory.Resolve<IDomainModel>();
 }
开发者ID:nutrija,项目名称:revenj,代码行数:7,代码来源:DryIocConfiguration.cs

示例3: Initialize

        public void Initialize(IObjectFactory factory)
        {
            if (!TraceAll && EnabledAspects.Count == 0)
                return;

            factory.RegisterTypes(new[] { typeof(LoggingInterceptor) });
            var logging = factory.Resolve<LoggingInterceptor>();
            var registrator = factory.Resolve<IInterceptorRegistrator>();
            if (TraceAll)
                registrator.Intercept(t => !DisabledAspects.Contains(t), logging);
            else
                EnabledAspects.ForEach(it => registrator.Intercept(it, logging));
        }
开发者ID:rpetrano,项目名称:revenj,代码行数:13,代码来源:Configuration.cs

示例4: Initialize

		public void Initialize(IObjectFactory factory)
		{
			var state = new Lazy<ISystemState>(() => factory.Resolve<ISystemState>());
			ISystemStartup si;
			foreach (var t in AssemblyScanner.GetAllTypes())
			{
				if (t.IsClass && (t.IsPublic || t.IsNestedPublic)
					&& typeof(ISystemStartup).IsAssignableFrom(t))
				{
					try
					{
						si = (ISystemStartup)Activator.CreateInstance(t);
					}
					catch (Exception ex)
					{
						throw new ConfigurationErrorsException("Error loading " + t.FullName + ". " + ex.Message, ex);
					}
					state.Value.Ready += f => si.Configure(f.Resolve<IServiceProvider>());
				}
			}
		}
开发者ID:dstimac,项目名称:revenj,代码行数:21,代码来源:SystemStartupAspect.cs

示例5: Initialize

 public void Initialize(IObjectFactory factory)
 {
     var types =
         (from type in AssemblyScanner.GetAllTypes()
          where type.IsClass
          where type.IsPublic || type.IsNestedPublic
          where typeof(ISystemStartup).IsAssignableFrom(type)
          select type)
         .ToList();
     var state = new Lazy<ISystemState>(() => factory.Resolve<ISystemState>());
     foreach (var t in types)
     {
         ISystemStartup si;
         try
         {
             si = (ISystemStartup)Activator.CreateInstance(t);
         }
         catch (Exception ex)
         {
             throw new ConfigurationErrorsException("Error loading " + t.FullName + ". " + ex.Message, ex);
         }
         state.Value.Ready += f => si.Configure(f.Resolve<IServiceLocator>());
     }
 }
开发者ID:nutrija,项目名称:revenj,代码行数:24,代码来源:SystemStartupAspect.cs

示例6: ModerationAuthentication

        public ModerationAuthentication(IObjectFactory factory)
        {
            Contract.Requires(factory != null);

            this.Repository = factory.Resolve<IDataCache<Korisnik>>();
        }
开发者ID:rpetrano,项目名称:ekade,代码行数:6,代码来源:ModerationAuthentication.cs


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