Esempio n. 1
0
        public static string BuildDeleteSqlByProperty(BaseEntity model, List <string> propertyNames, ORMDBType dbType)
        {
            Type       t        = model.GetType();
            EntityMeta metadeta = EntityReflect.GetDefineInfoFromType(t);
            string     sql      = SQLBuilderFactory.Instance.GetSQLBuilder(dbType).BuildDeleteSqlByProperty(metadeta, propertyNames);

            return(sql);
        }
Esempio n. 2
0
        public static string GetDeleteByPkSql(BaseEntity model, ORMDBType dbType)
        {
            Type type = model.GetType();

            if (!_DeleteByPkSqlCache.ContainsKey(type))
            {
                EntityMeta metadeta = EntityReflect.GetDefineInfoFromType(type);
                _DeleteByPkSqlCache.TryAdd(type, SQLBuilderFactory.Instance.GetSQLBuilder(dbType).BuildDeleteByPkSql(metadeta));
            }
            return(_DeleteByPkSqlCache[type]);
        }
Esempio n. 3
0
        public static string GetAllColumns(Type entityType, ORMDBType dbType, string prefix)
        {
            string t = entityType.FullName + prefix;

            if (!_AllColumnsSqlCache.ContainsKey(t))
            {
                EntityMeta metadata = EntityReflect.GetDefineInfoFromType(entityType);
                string     sql      = SQLBuilderFactory.Instance.GetSQLBuilder(dbType).GetAllColumns(metadata, prefix);
                _AllColumnsSqlCache.TryAdd(t, sql);
            }
            return(_AllColumnsSqlCache[t]);
        }
Esempio n. 4
0
        private static string GetUpdateFullSql(BaseEntity model, ORMDBType dbType)
        {
            Type type = model.GetType();

            if (!_UpdateSqlCache.ContainsKey(type))
            {
                EntityMeta metadeta = EntityReflect.GetDefineInfoFromType(type);
                string     sql      = SQLBuilderFactory.Instance.GetSQLBuilder(dbType).BuildUpdateSql(metadeta);
                _UpdateSqlCache.TryAdd(type, sql);
            }
            return(_UpdateSqlCache[type]);
        }
Esempio n. 5
0
        public static string GetReplaceInsertSQL(BaseEntity model, ORMDBType dbType)
        {
            Type t = model.GetType();

            if (!_ReplaceSqlCache.ContainsKey(t))
            {
                EntityMeta metadeta = EntityReflect.GetDefineInfoFromType(t);
                string     sql      = SQLBuilderFactory.Instance.GetSQLBuilder(dbType).BuildReplaceInsertSQL(metadeta);
                if (!_ReplaceSqlCache.ContainsKey(t))
                {
                    _ReplaceSqlCache.TryAdd(t, sql);
                }
            }
            return(_ReplaceSqlCache[t]);
        }
Esempio n. 6
0
        public string GetReplaceInsertSQL()
        {
            Type t = this.GetType();

            if (!_ReplaceSqlCache.ContainsKey(t))
            {
                EntityMeta metadeta = EntityReflect.GetDefineInfoFromType(t);
                string     sql      = _builder.BuildReplaceInsertSQL(metadeta);
                lock (lockobject)
                {
                    if (!_ReplaceSqlCache.ContainsKey(t))
                    {
                        _ReplaceSqlCache.Add(t, sql);
                    }
                }
            }
            return(_ReplaceSqlCache[t]);
        }
Esempio n. 7
0
        private string GetUpdateFullSql()
        {
            Type t = this.GetType();

            if (!_UpdateSqlCache.ContainsKey(t))
            {
                EntityMeta metadeta = EntityReflect.GetDefineInfoFromType(t);
                string     sql      = EntitySQLBuilder.EntityMetaToUpdateSQL(metadeta);
                lock (lockobject)
                {
                    if (!_UpdateSqlCache.ContainsKey(t))
                    {
                        _UpdateSqlCache.Add(t, sql);
                    }
                }
            }
            return(_UpdateSqlCache[t]);
        }
Esempio n. 8
0
        public static string GetDeleteSqlByChangeProperty(BaseEntity model, ORMDBType dbType)
        {
            EntityMeta metadeta = EntityReflect.GetDefineInfoFromType(model.GetType());

            return(SQLBuilderFactory.Instance.GetSQLBuilder(dbType).BuildDeleteSqlByColumns(metadeta, model.GetPropertyChangedList()));
        }
Esempio n. 9
0
        private static string GetUpdateChangeColumnsSql(BaseEntity model, ORMDBType dbTyp)
        {
            EntityMeta metadeta = EntityReflect.GetDefineInfoFromType(model.GetType());

            return(SQLBuilderFactory.Instance.GetSQLBuilder(dbTyp).BuildUpdateSql(metadeta, model.GetPropertyChangedList()));
        }
Esempio n. 10
0
        public static string GetTableName(Type entityType)
        {
            EntityMeta metadata = EntityReflect.GetDefineInfoFromType(entityType);

            return(metadata?.TableName);
        }
Esempio n. 11
0
        private string GetUpdateChangeColumnsSql()
        {
            EntityMeta metadeta = EntityReflect.GetDefineInfoFromType(this.GetType());

            return(EntitySQLBuilder.BuildUpdateSql(metadeta, this._PropertyChangedList));
        }