本文整理汇总了C#中ConfigurationExpression.Scan方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationExpression.Scan方法的具体用法?C# ConfigurationExpression.Scan怎么用?C# ConfigurationExpression.Scan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigurationExpression
的用法示例。
在下文中一共展示了ConfigurationExpression.Scan方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
protected override void Configure(ConfigurationExpression cfg)
{
cfg.Scan(x =>
{
x.TheCallingAssembly();
x.LookForRegistries();
});
}
示例2: SetupContainer
private static void SetupContainer(ConfigurationExpression x)
{
x.Scan(i =>
{
i.TheCallingAssembly();
i.Convention<SettingsScanner>();
});
x.SetAllProperties(s => s.Matching(p => p.Name.EndsWith("Settings")));
}
示例3: Initialize
private static void Initialize(ConfigurationExpression initializer)
{
var tfsPlugin = TfsPlugin.Find();
initializer.Scan(x => { Initialize(x); tfsPlugin.Initialize(x); });
initializer.For<TextWriter>().Use(() => Console.Out);
initializer.For<IGitRepository>().Add<GitRepository>();
AddGitChangeTypes(initializer);
DoCustomConfiguration(initializer);
tfsPlugin.Initialize(initializer);
}
示例4: SetupContainer
private static void SetupContainer(ConfigurationExpression x)
{
x.For<IHttpSession>().Use<CurrentHttpContextSession>();
x.Scan(i =>
{
i.TheCallingAssembly();
i.Convention<SettingsScanner>();
});
x.For<ISettingsProvider>().Use<AppSettingsProvider>();
x.SetAllProperties(s => s.Matching(p => p.Name.EndsWith("Settings")));
}
示例5: OnConfigure
private static void OnConfigure(ConfigurationExpression x)
{
x.Scan(cfg =>
{
cfg.TheCallingAssembly();
x.For(typeof(IReportingRepository<>)).Use(typeof(InMemoryRepository<>));
cfg.WithDefaultConventions();
});
// include the LixRegistry
x.IncludeRegistry(new LixRegistry());
}
示例6: SetupContainer
private static void SetupContainer(ConfigurationExpression map)
{
map.Scan(x =>
{
x.TheCallingAssembly();
x.WithDefaultConventions();
x.LookForRegistries();
x.AddAllTypesOf<IPropertyBinder>();
x.ConnectImplementationsToTypesClosing(typeof (IValidator<>));
PackageRegistry.PackageAssemblies.Each(x.Assembly);
});
map.For<IContinuationDirector>().Use<ContinuationHandler>();
}
示例7: OnConfigureInMemory
private static void OnConfigureInMemory(ConfigurationExpression cfg)
{
// Configure a single inmemorydatastore to be used
cfg.For(typeof(InMemoryDataStore)).LifecycleIs(InstanceScope.Hybrid);
// Configure our IoC container for a inmemoryrepository
var repositoryInstance = cfg.For(typeof(IReportingRepository<>)).Use(typeof(InMemoryRepository<>));
cfg.For(typeof(IDomainRepository<>)).Use(repositoryInstance);
cfg.For(typeof(ILinqEnabledRepository<>)).Use(repositoryInstance);
cfg.For(typeof(IUnitOfWork)).LifecycleIs(InstanceScope.Hybrid).Use(typeof(InMemoryUnitOfWork));
// include the LixRegistry
cfg.IncludeRegistry(new LixRegistry());
cfg.Scan(s =>
{
s.TheCallingAssembly();
s.WithDefaultConventions();
});
}
示例8: Initialize
private static void Initialize(ConfigurationExpression initializer)
{
ConfigureLogger();
var tfsPlugin = TfsPlugin.Find();
initializer.Scan(x => { Initialize(x); tfsPlugin.Initialize(x); });
initializer.For<IGitRepository>().Add<GitRepository>();
AddGitChangeTypes(initializer);
DoCustomConfiguration(initializer);
tfsPlugin.Initialize(initializer);
}
示例9: Scan
private static void Scan(ConfigurationExpression configExpression)
{
configExpression.Scan(ScanAssemblies);
}
示例10: OnConfigureNHibernate
private static void OnConfigureNHibernate(ConfigurationExpression cfg)
{
HibernatingRhinos.NHibernate.Profiler.Appender.NHibernateProfiler.Initialize();
var configuration = Fluently.Configure()
.Mappings(x => x.AutoMappings.Add(AutoMap.AssemblyOf<Person>().Where(t => typeof(Person).IsAssignableFrom(t))))
.Database(SQLiteConfiguration.Standard.InMemory().ShowSql());
var sessionFactory = configuration.BuildSessionFactory();
// Configure nhibernate
cfg.For<ISessionFactory>().Singleton().Use(sessionFactory);
cfg.For<ISession>().Singleton().Use(x =>
{
var session = x.GetInstance<ISessionFactory>().OpenSession();
session.FlushMode = FlushMode.Commit;
using (var tx =session.BeginTransaction())
{
new SchemaExport(configuration.BuildConfiguration()).Execute(true, true, false, session.Connection, null);
tx.Commit();
}
return session;
});
// Configure our IoC container for a nhibernaterepository
cfg.AddRegistry(new LixNHibernateRegistry());
// include the LixRegistry
cfg.AddRegistry(new LixRegistry());
cfg.Scan(s =>
{
s.TheCallingAssembly();
s.WithDefaultConventions();
});
}