/// <summary>
        /// 注册 关闭 事件
        /// </summary>
        static LoggerManager()
        {
            try
            {
                RegisterAppDomainEvents();
            }
            catch (System.Security.SecurityException)
            {
                LogLog.Debug(declaringType, "Security Exception (ControlAppDomain LinkDemand) while trying " +
                             "to register Shutdown handler with the AppDomain. LoggerManager.Shutdown() " +
                             "will not be called automatically when the AppDomain exits. It must be called " +
                             "programmatically.");
            }

            LogLog.Debug(declaringType, GetVersionInfo());

            string appRepositorySelectorTypeName = SystemInfo.GetAppSetting("log4net.RepositorySelector");

            if (appRepositorySelectorTypeName != null && appRepositorySelectorTypeName.Length > 0)
            {
                // Resolve the config string into a Type
                Type appRepositorySelectorType = null;
                try
                {
                    appRepositorySelectorType = SystemInfo.GetTypeFromString(appRepositorySelectorTypeName, false, true);
                }
                catch (Exception ex)
                {
                    LogLog.Error(declaringType, "Exception while resolving RepositorySelector Type [" + appRepositorySelectorTypeName + "]", ex);
                }

                if (appRepositorySelectorType != null)
                {
                    // Create an instance of the RepositorySelectorType
                    object appRepositorySelectorObj = null;
                    try
                    {
                        appRepositorySelectorObj = Activator.CreateInstance(appRepositorySelectorType);
                    }
                    catch (Exception ex)
                    {
                        LogLog.Error(declaringType, "Exception while creating RepositorySelector [" + appRepositorySelectorType.FullName + "]", ex);
                    }

                    if (appRepositorySelectorObj != null && appRepositorySelectorObj is IRepositorySelector)
                    {
                        s_repositorySelector = (IRepositorySelector)appRepositorySelectorObj;
                    }
                    else
                    {
                        LogLog.Error(declaringType, "RepositorySelector Type [" + appRepositorySelectorType.FullName + "] is not an IRepositorySelector");
                    }
                }
            }

            if (s_repositorySelector == null)
            {
                s_repositorySelector = new DefaultRepositorySelector(typeof(Repository.Hierarchy.Hierarchy));
            }
        }
Example #2
0
 static LoggerManager()
 {
     try
     {
         RegisterAppDomainEvents();
     }
     catch (SecurityException)
     {
         LogLog.Debug(declaringType, "Security Exception (ControlAppDomain LinkDemand) while trying to register Shutdown handler with the AppDomain. LoggerManager.Shutdown() will not be called automatically when the AppDomain exits. It must be called programmatically.");
     }
     LogLog.Debug(declaringType, GetVersionInfo());
     s_repositorySelector = new CompactRepositorySelector(typeof(log4net.Repository.Hierarchy.Hierarchy));
 }
 public static RavenDbConfiguration RavenDb(this IRepositorySelector selector)
 {
     return(new RavenDbConfiguration());
 }
 public static MongoDbConfiguration MongoDB(this IRepositorySelector selector)
 {
     return(new MongoDbConfiguration());
 }
Example #5
0
 static Configure()
 {
     RepositorySelector = new RepositorySelector();
     _masterConfiguration = new nRepoConfiguration();
 }
 public static CouchDbConfiguration CouchDb(this IRepositorySelector selector)
 {
     return(new CouchDbConfiguration());
 }
Example #7
0
 public static ShardedNhibernateConfiguration ShardedNHibernate(this IRepositorySelector selector)
 {
     return(new ShardedNhibernateConfiguration());
 }
Example #8
0
 public RepositorySelectorWrapper(IRepositorySelector inner)
 {
     _inner = inner ?? throw new ArgumentNullException(nameof(inner));
 }
Example #9
0
 public static EntityFrameworkConfiguration EntityFramework(this IRepositorySelector selector)
 {
     return(new EntityFrameworkConfiguration());
 }