示例#1
0
        /// <summary>
        /// Создает новый экземпляр приложения.
        /// </summary>
        /// <exception cref="ArgumentNullException">Возникает, если <paramref name="dbConfigurationBuilder"/> равен null.</exception>
        public OnXApplication(string physicalApplicationPath, IDbConfigurationBuilder dbConfigurationBuilder)
        {
            if (dbConfigurationBuilder == null)
            {
                throw new ArgumentNullException(nameof(dbConfigurationBuilder));
            }

            try
            {
                if (string.IsNullOrEmpty(physicalApplicationPath))
                {
                    physicalApplicationPath = Environment.CurrentDirectory;
                }

                LibraryEnumeratorFactory.GlobalAssemblyFilter = (name) =>
                {
                    if (name.ToLower().Contains("sni.dll"))
                    {
                        return(false);
                    }
                    if (name.ToLower().Contains("e_sqlite3.dll"))
                    {
                        return(false);
                    }

                    return(true);
                };

                LibraryEnumeratorFactory.LibraryDirectory = physicalApplicationPath;
                ApplicationWorkingFolder = physicalApplicationPath;

                _dbConfigurationBuilder = dbConfigurationBuilder;
                CoreContextBase.OptionsBuilderStaticForCoreContexts = (optionsBuilder) => dbConfigurationBuilder.OnConfigureEntityFrameworkCore(optionsBuilder);
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error init ApplicationCore: {0}", ex.ToString());
                if (ex.InnerException != null)
                {
                    Debug.WriteLine("Error init ApplicationCore inner: {0}", ex.InnerException.Message);
                }
                if (ex.InnerException?.InnerException != null)
                {
                    Debug.WriteLine("Error init ApplicationCore inner inner: {0}", ex.InnerException.InnerException.Message);
                }
                if (ex.InnerException?.InnerException?.InnerException != null)
                {
                    Debug.WriteLine("Error init ApplicationCore inner inner inner: {0}", ex.InnerException.InnerException.InnerException.Message);
                }

                throw;
            }
        }
示例#2
0
 /// <summary>
 /// Создает новый экземпляр приложения.
 /// </summary>
 /// <exception cref="ArgumentNullException">Возникает, если <paramref name="dbConfigurationBuilder"/> равен null.</exception>
 public OnXApplication(IDbConfigurationBuilder dbConfigurationBuilder) : this(Environment.CurrentDirectory, dbConfigurationBuilder)
 {
 }
示例#3
0
 public OnXApplicationAspNetMvc(string physicalApplicationPath, IDbConfigurationBuilder dbConfigurationBuilder) : base(physicalApplicationPath, dbConfigurationBuilder)
 {
 }