本文整理汇总了C#中IObjectFactory类的典型用法代码示例。如果您正苦于以下问题:C# IObjectFactory类的具体用法?C# IObjectFactory怎么用?C# IObjectFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IObjectFactory类属于命名空间,在下文中一共展示了IObjectFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Context
//private readonly IRepositoryBulkReader BulkReader;
//private readonly Lazy<World>[] LazyWorlds = new Lazy<World>[512];
public Context(IObjectFactory factory, IDatabaseQueryManager manager)
{
var scope = factory.CreateScope(null);
scope.RegisterInterfaces(manager.StartQuery(false));
WorldRepository = scope.Resolve<IPersistableRepository<World>>();
FortuneRepository = scope.Resolve<IQueryableRepository<Fortune>>();
//BulkReader = scope.BulkRead(ChunkedMemoryStream.Static());
}
示例2: PollAnswerViewModel
public PollAnswerViewModel(IPoll poll,
IObjectFactory<IPollOption> objectFactory, short optionPosition)
{
this.poll = poll;
this.objectFactory = objectFactory;
this.optionPosition = optionPosition;
}
示例3: 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));
}
示例4: DefaultActivator
public DefaultActivator(IObjectFactory objectFactory, IServiceDependencyInspector serviceDependencyInspector, IServiceEntryResolver serviceEntryResolver, ServiceEntry entry)
{
_objectFactory = objectFactory;
_serviceEntryResolver = serviceEntryResolver;
_serviceDependencyInspector = serviceDependencyInspector;
_entry = entry;
}
示例5: Initialize
public virtual void Initialize([NotNull] Type interfaceType, IObjectFactory objectFactory)
{
Assert.ArgumentNotNull(interfaceType, "interfaceType");
Assert.ArgumentNotNull(objectFactory, "objectFactory");
this.InterfaceType = interfaceType;
this.ObjectFactory = objectFactory;
}
示例6: SecurityApplicationProcessingRule
public SecurityApplicationProcessingRule(ISecurityAuthorizationProvider securityAuthorizationProvider, IGenericRepository genericRepository, ISecurityContext securityContext, IObjectFactory objectFactory)
{
_securityAuthorizationProvider = securityAuthorizationProvider;
_genericRepository = genericRepository;
_securityContext = securityContext;
_objectFactory = objectFactory;
}
示例7: DomainModel
public DomainModel(
IEnumerable<Assembly> assemblies,
IObjectFactory objectFactory)
{
Contract.Requires(assemblies != null);
Contract.Requires(objectFactory != null);
DomainAssemblies = assemblies.ToList();
try
{
foreach (var asm in assemblies)
foreach (var type in asm.GetTypes())
if (typeof(ISystemAspect).IsAssignableFrom(type))
{
var aspect = (ISystemAspect)Activator.CreateInstance(type);
aspect.Initialize(objectFactory);
}
}
catch (ReflectionTypeLoadException ex)
{
var first = (ex.LoaderExceptions ?? new Exception[0]).Take(5).ToList();
throw new ApplicationException(string.Format(@"Can't load types:
{0}
", string.Join(Environment.NewLine, first.Select(it => it.Message))), ex);
}
}
示例8: 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>();
}
示例9: PatientDetailViewController
public PatientDetailViewController(IObjectFactory objectFactory)
{
this.ObjectFactory = objectFactory;
this.PatientManager = this.ObjectFactory.Create<IPatientManager>();
this.navBar = new UINavigationBar(new RectangleF(0,0,768, 44));
this.navBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
this.navBar.SetItems(
new[]
{
new UINavigationItem("Patient Information")
},false);
this.navBar.TopItem.SetRightBarButtonItem(this.EditButtonItem, false);
this.View.BackgroundColor = UIColor.LightGray;
this.View.Frame = new RectangleF(0,0,768,768);
this.patientDetailView = this.ObjectFactory.Create<PatientDetailView>();
this.patientDetailView.Frame = new RectangleF(0,44,this.colWidth1 + this.colWidth2, 728);
this.patientDetailView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight;
this.View.AddSubview (this.patientDetailView);
this.View.AddSubview (this.navBar);
}
示例10: CreateSession
public ISession CreateSession(IDictionary<string, string> parameters, IObjectFactory objectFactory, AbstractAuthenticationProvider authenticationProvider, ICache cache)
{
Session session = new Session(parameters, objectFactory, authenticationProvider, cache);
session.Connect();
return session;
}
示例11: ScopePool
public ScopePool(
IObjectFactory factory,
IDatabaseQueryManager queries,
IExtensibilityProvider extensibilityProvider)
{
this.Factory = factory;
this.Queries = queries;
if (!int.TryParse(ConfigurationManager.AppSettings["Processing.PoolSize"], out Size))
Size = 20;
if (!Enum.TryParse<PoolMode>(ConfigurationManager.AppSettings["Processing.PoolMode"], out Mode))
{
//TODO: Mono has issues with BlockingCollection. use None as default
int p = (int)Environment.OSVersion.Platform;
if (p == 4 || p == 6 || p == 128)
Mode = PoolMode.None;
else
Mode = PoolMode.IfAvailable;
}
var commandTypes = extensibilityProvider.FindPlugins<IServerCommand>();
Factory.RegisterTypes(commandTypes, InstanceScope.Context);
if (Mode != PoolMode.None)
{
if (Size < 1) Size = 1;
for (int i = 0; i < Size; i++)
Scopes.Add(SetupReadonlyScope());
}
}
示例12: DeployDependenciesTask
public DeployDependenciesTask(
string projectName,
string targetEnvironment,
Guid deploymentId,
IProjectInfoRepository projectInfoRepository,
IObjectFactory objectFactory,
ITeamCityRestClient temCityRestClient,
IDependentProjectsToDeployWebSelector dependentProjectsToDeploySelector)
{
Guard.NotNullNorEmpty(projectName, "projectName");
Guard.NotNullNorEmpty(targetEnvironment, "targetEnvironment");
Guard.NotEmpty(deploymentId, "deploymentId");
Guard.NotNull(projectInfoRepository, "projectInfoRepository");
Guard.NotNull(objectFactory, "objectFactory");
Guard.NotNull(temCityRestClient, "temCityRestClient");
Guard.NotNull(dependentProjectsToDeploySelector, "dependentProjectsToDeploySelector");
_projectName = projectName;
_targetEnvironment = targetEnvironment;
_deploymentId = deploymentId;
_projectInfoRepository = projectInfoRepository;
_objectFactory = objectFactory;
_temCityRestClient = temCityRestClient;
_dependentProjectsToDeploySelector = dependentProjectsToDeploySelector;
_subTasks = new List<DeploymentTaskBase>();
}
示例13: RunGlobalManagers
private static void RunGlobalManagers(IObjectFactory objectFactory)
{
// run market manager.
objectFactory.GetMarketManager();
// start pool manager.
objectFactory.GetPoolManager();
// run algorithm manager.
objectFactory.GetAlgorithmManager();
// run payment manager
objectFactory.GetPaymentDaemonManager();
// run statistics manager.
objectFactory.GetStatisticsManager();
// run software repository.
objectFactory.GetSoftwareRepository();
#if DEBUG
// only initialize metrics support in debug mode
objectFactory.GetMetricsManager();
#endif
// start web server.
objectFactory.GetWebServer();
}
示例14: PollResultsPageViewModel
public PollResultsPageViewModel(
INavigation navigation,
IObjectFactory<IPollResults> objectFactory,
IObjectFactory<IPoll> pollFactory,
IObjectFactory<IPollComment> pollCommentFactory,
IMessageBox messageBox
#if NETFX_CORE
, IShareManager shareManager,
ISecondaryPinner secondaryPinner
#endif // NETFX_CORE
)
: base(navigation)
{
this.objectFactory = objectFactory;
this.pollFactory = pollFactory;
this.pollCommentFactory = pollCommentFactory;
this.messageBox = messageBox;
this.PollComments = new ObservableCollection<PollCommentViewModel>();
#if NETFX_CORE
this.shareManager = shareManager;
this.secondaryPinner = secondaryPinner;
#endif // NETFX_CORE
}
示例15: AGSUIFactory
public AGSUIFactory(IContainer resolver, IGameState gameState, IGraphicsFactory graphics, IObjectFactory obj)
{
_resolver = resolver;
_gameState = gameState;
_graphics = graphics;
_object = obj;
}