本文整理汇总了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));
}
示例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>();
}
示例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));
}
示例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>());
}
}
}
示例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>());
}
}
示例6: ModerationAuthentication
public ModerationAuthentication(IObjectFactory factory)
{
Contract.Requires(factory != null);
this.Repository = factory.Resolve<IDataCache<Korisnik>>();
}