本文整理汇总了C#中N2.Configuration.DatabaseSection类的典型用法代码示例。如果您正苦于以下问题:C# DatabaseSection类的具体用法?C# DatabaseSection怎么用?C# DatabaseSection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DatabaseSection类属于N2.Configuration命名空间,在下文中一共展示了DatabaseSection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IndexerServer
public IndexerServer(DatabaseSection config)
{
if (config == null)
config = new DatabaseSection();
Init(config.Search.Server.UrlPrefix, config.Search.Server.SharedSecret, config.Search.IndexPath);
}
示例2: SessionProvider
public SessionProvider(IConfigurationBuilder builder, NHInterceptorFactory interceptorFactory, IWebContext webContext, DatabaseSection config)
{
nhSessionFactory = builder.BuildSessionFactory();
this.webContext = webContext;
this.interceptorFactory = interceptorFactory;
this.isolation = config.Isolation;
}
示例3: SearchConfigurationBuilderParticipator
public SearchConfigurationBuilderParticipator(IWebContext webContext, DatabaseSection config)
{
this.webContext = webContext;
searchEnabled = config.Search.Enabled;
asyncIndexing = config.Search.AsyncIndexing;
indexPath = config.Search.IndexPath;
}
示例4: IndexerClient
public IndexerClient(DatabaseSection config)
{
serverUrl = config.Search.Client.Url;
timeout = config.Search.Client.IndexTimeout;
sharedSecret = config.Search.Client.SharedSecret;
instanceName = config.Search.Client.InstanceName;
}
示例5: ContentChangeTracker
public ContentChangeTracker(IAsyncIndexer indexer, IPersister persister, ConnectionMonitor connection, DatabaseSection config)
{
this.indexer = indexer;
if (!config.Search.Enabled)
return;
if (!string.IsNullOrEmpty(config.Search.IndexOnMachineNamed) && config.Search.IndexOnMachineNamed != Environment.MachineName)
return;
connection.Online += delegate
{
IsMonitoring = true;
persister.ItemSaved += persister_ItemSaved;
persister.ItemMoving += persister_ItemMoving;
persister.ItemMoved += persister_ItemMoved;
persister.ItemCopied += persister_ItemCopied;
persister.ItemDeleted += persister_ItemDeleted;
};
connection.Offline += delegate
{
IsMonitoring = false;
persister.ItemSaved -= persister_ItemSaved;
persister.ItemMoving -= persister_ItemMoving;
persister.ItemMoved -= persister_ItemMoved;
persister.ItemCopied -= persister_ItemCopied;
persister.ItemDeleted -= persister_ItemDeleted;
};
}
示例6: DiagnosticController
public DiagnosticController(IContentItemRepository repository, IHost host, IDefinitionManager definitions,
ILinkGenerator linkGenerator, IUrlParser parser, DatabaseSection config, IFlushable flushable, IReplicationStorage repstore,
IFileSystemFactory fileSystemFactory)
{
_repository = repository;
_host = host;
_definitions = definitions;
_linkGenerator = linkGenerator;
_parser = parser;
_flushable = flushable;
_tablePrefix = config.TablePrefix;
_repstore = repstore;
if (_forceWriteLockManager != null) return;
// Create Force Write Lock Manager
var storageConfig = (FileSystemNamespace) Enum.Parse(typeof (FileSystemNamespace),
ConfigurationManager.AppSettings["AzureReplicationStorageContainerName"] ??
"ReplicationStorageDebug");
var fileSystem = fileSystemFactory.Create(storageConfig);
_forceWriteLockManager = new ReplicationForceWriteLockManager(fileSystem);
_writeLockManager = new ReplicationWriteLockManager(fileSystem);
}
示例7: SetupMappings
private void SetupMappings(DatabaseSection config)
{
foreach (MappingElement me in config.Mappings)
{
mappingNames.Add(me.Name);
}
}
示例8: ContentChangeTracker
public ContentChangeTracker(IIndexer indexer, IPersister persister, IWorker worker, ConnectionMonitor connection, IErrorNotifier errors, DatabaseSection config)
{
this.indexer = indexer;
this.persister = persister;
this.worker = worker;
this.errors = errors;
this.async = config.Search.AsyncIndexing;
this.handleErrors = config.Search.HandleErrors;
RetryInterval = TimeSpan.FromMinutes(2);
if(config.Search.Enabled)
{
connection.Online += delegate
{
persister.ItemSaved += persister_ItemSaved;
persister.ItemMoving += persister_ItemMoving;
persister.ItemMoved += persister_ItemMoved;
persister.ItemCopied += persister_ItemCopied;
persister.ItemDeleted += persister_ItemDeleted;
};
connection.Offline += delegate
{
persister.ItemSaved -= persister_ItemSaved;
persister.ItemMoving -= persister_ItemMoving;
persister.ItemMoved -= persister_ItemMoved;
persister.ItemCopied -= persister_ItemCopied;
persister.ItemDeleted -= persister_ItemDeleted;
};
}
}
示例9: SetupProperties
/// <summary>Sets properties configuration dictionary based on configuration in the database section.</summary>
/// <param name="config">The database section configuration.</param>
/// <param name="connectionStrings">Connection strings from configuration</param>
protected void SetupProperties(DatabaseSection config, ConnectionStringsSection connectionStrings)
{
NHibernate.Cfg.Environment.UseReflectionOptimizer = Utility.GetTrustLevel() > System.Web.AspNetHostingPermissionLevel.Medium;
// connection
Properties[NHibernate.Cfg.Environment.ConnectionStringName] = config.ConnectionStringName;
Properties[NHibernate.Cfg.Environment.ConnectionProvider] = "NHibernate.Connection.DriverConnectionProvider";
Properties[NHibernate.Cfg.Environment.Hbm2ddlKeyWords] = "none";
SetupFlavourProperties(config, connectionStrings);
bool useNonBatcher =
// configured batch size <= 1
(batchSize.HasValue && batchSize.Value <= 1)
// medium trust in combination with sql client driver
// causes fault: Attempt by method 'NHibernate.AdoNet.SqlClientSqlCommandSet..ctor()' to access method 'System.Data.SqlClient.SqlCommandSet..ctor()' failed. at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
|| (Utility.GetTrustLevel() <= System.Web.AspNetHostingPermissionLevel.Medium && typeof(SqlClientDriver).IsAssignableFrom(Type.GetType(Properties[Environment.ConnectionDriver])));
if (useNonBatcher)
Properties[NHibernate.Cfg.Environment.BatchStrategy] = typeof(NonBatchingBatcherFactory).AssemblyQualifiedName;
SetupCacheProperties(config);
if (config.Isolation.HasValue)
Properties[NHibernate.Cfg.Environment.Isolation] = config.Isolation.ToString();
foreach (string key in config.HibernateProperties.AllKeys)
{
Properties[key] = config.HibernateProperties[key].Value;
}
}
示例10: SessionProvider
public SessionProvider(IConfigurationBuilder builder, NHInterceptorFactory interceptorFactory, IWebContext webContext, DatabaseSection config)
{
nhSessionFactory = builder.BuildSessionFactory();
this.webContext = webContext;
this.interceptorFactory = interceptorFactory;
this.isolation = config.Isolation;
this.autoStartTransaction = config.AutoStartTransaction;
this.CacheEnabled = config.Caching;
}
示例11: AsyncIndexer
public AsyncIndexer(IContentIndexer indexer, IPersister persister, IWorker worker, IErrorNotifier errors, DatabaseSection config)
{
RetryInterval = TimeSpan.FromMinutes(2);
this.async = config.Search.AsyncIndexing;
this.handleErrors = config.Search.HandleErrors;
this.indexer = indexer;
this.persister = persister;
this.worker = worker;
this.errors = errors;
}
示例12: AzureFileSystem
public AzureFileSystem(ISessionProvider sessionProvider, DatabaseSection config)
{
var storageAccount = CloudStorageAccount.Parse(
ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString);
this.container = storageAccount.CreateCloudBlobClient().GetContainerReference("le-upload");
container.CreateIfNotExists();
container.SetPermissions(new BlobContainerPermissions { PublicAccess = BlobContainerPublicAccessType.Container });
CreateDirectory("/upload/");
}
示例13: ReplicationManager
public ReplicationManager(
IPersister persister,
IItemFinder finder,
IReplicationStorage repstore,
IFileSystemFactory fileSystemFactory,
DatabaseSection dataBaseSection,
ISecurityManager security
)
: this(persister, finder, repstore, fileSystemFactory, dataBaseSection, security, null, null)
{
// needed to be able to execute N2 unit tests w/o additional dependecies
}
示例14: InstallationManager
public InstallationManager(IHost host, DefinitionMap map, ContentActivator activator, Importer importer, IPersister persister, ISessionProvider sessionProvider, IConfigurationBuilder configurationBuilder, IWebContext webContext, ConnectionMonitor connectionContext, DatabaseSection config)
{
this.host = host;
this.map = map;
this.activator = activator;
this.importer = importer;
this.persister = persister;
this.sessionProvider = sessionProvider;
this.configurationBuilder = configurationBuilder;
this.webContext = webContext;
this.connectionContext = connectionContext;
this.isDatabaseFileSystemEnbled = config.Files.StorageLocation == FileStoreLocation.Database;
}
示例15: ConfigurationBuilder
/// <summary>Creates a new instance of the <see cref="ConfigurationBuilder"/>.</summary>
public ConfigurationBuilder(IDefinitionProvider[] definitionProviders, ClassMappingGenerator generator, IWebContext webContext, ConfigurationBuilderParticipator[] participators, DatabaseSection config, ConnectionStringsSection connectionStrings)
{
this.definitionProviders = definitionProviders;
this.generator = generator;
this.webContext = webContext;
this.participators = participators;
if (config == null) config = new DatabaseSection();
TryLocatingHbmResources = config.TryLocatingHbmResources;
tablePrefix = config.TablePrefix;
batchSize = config.BatchSize;
childrenLaziness = config.ChildrenLaziness;
SetupProperties(config, connectionStrings);
SetupMappings(config);
}