public DefaultDatabaseEntityDefFactory(IDatabaseSettings databaseSettings, IDatabaseEngine databaseEngine, IDatabaseTypeConverterFactory typeConverterFactory)
        {
            _databaseSettings     = databaseSettings;
            _databaseEngine       = databaseEngine;
            _typeConverterFactory = typeConverterFactory;

            _allEntityTypes   = ReflectUtil.GetAllTypeByCondition(t => t.IsSubclassOf(typeof(DatabaseEntity)));
            _entitySchemaDict = ConstructeSchemaDict();

            WarmUp();
        }
        public static void Initialize(IKVStoreEngine kVStoreEngine)
        {
            _settings = kVStoreEngine.Settings;
            _firstDefaultInstanceName = kVStoreEngine.FirstDefaultInstanceName;

            IEnumerable <Type> allEntityTypes;

            if (_settings.AssembliesIncludeEntity.IsNullOrEmpty())
            {
                allEntityTypes = ReflectUtil.GetAllTypeByCondition(kvstoreEntityTypeCondition);
            }
            else
            {
                allEntityTypes = ReflectUtil.GetAllTypeByCondition(kVStoreEngine.Settings.AssembliesIncludeEntity, kvstoreEntityTypeCondition);
            }

            _typeSchemaDict = ConstructeSchemaDict(allEntityTypes);
Exemple #3
0
        /// <summary>
        /// Initialize
        /// </summary>
        /// <param name="databaseEngine"></param>
        /// <exception cref="DatabaseException"></exception>
        public static void Initialize(IDatabaseEngine databaseEngine)
        {
            DatabaseCommonSettings databaseSettings = databaseEngine.DatabaseSettings;

            VarcharDefaultLength = databaseSettings.DefaultVarcharLength == 0 ? LengthConvention.DEFAULT_VARCHAR_LENGTH : databaseSettings.DefaultVarcharLength;

            IEnumerable <Type> allEntityTypes;

            if (databaseSettings.AssembliesIncludeEntity.IsNullOrEmpty())
            {
                allEntityTypes = ReflectUtil.GetAllTypeByCondition(entityTypeCondition);
            }
            else
            {
                allEntityTypes = ReflectUtil.GetAllTypeByCondition(databaseSettings.AssembliesIncludeEntity, entityTypeCondition);
            }

            IDictionary <string, EntitySetting> entitySchemaDict = ConstructeSchemaDict(databaseSettings, databaseEngine, allEntityTypes);

            WarmUp(allEntityTypes, databaseEngine.EngineType, entitySchemaDict);