Beispiel #1
0
        public DBConnection(COREobject core, bool isShared = false)
        {
            _core             = core;
            IsShared          = isShared;
            _type             = Application?.DB_Type ?? Entitron.DefaultDBType;
            _connectionString = (Application != null && !string.IsNullOrEmpty(Application.DB_ConnectionString))
                    ? Application.DB_ConnectionString
                    : Entitron.EntitronConnectionString(_type);

            _tablesToSave = new HashSet <DBTable>();
            _commandSet   = DBCommandSet.GetDBCommandSet(_type);
        }
Beispiel #2
0
        public static ESqlType GetSqlType(string typeProvider)
        {
            foreach (Type commandSetType in CommandSets)
            {
                DBCommandSet commandSet = (DBCommandSet)Activator.CreateInstance(commandSetType);
                if (commandSet.ProviderName == typeProvider)
                {
                    return(commandSet.Type);
                }
            }

            throw new InvalidOperationException("Unknown provider name");
        }
Beispiel #3
0
        public static DBCommandSet GetDBCommandSet(ESqlType type)
        {
            foreach (Type commandSetType in CommandSets)
            {
                DBCommandSet commandSet = (DBCommandSet)Activator.CreateInstance(commandSetType);
                if (commandSet.Type == type)
                {
                    return(commandSet);
                }
            }

            throw new InvalidOperationException("Unknown ESqlType");
        }