示例#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);
        }
示例#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]);
        }
示例#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]);
        }
示例#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]);
        }
示例#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]);
        }
示例#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]);
        }
示例#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]);
        }
示例#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()));
        }
示例#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()));
        }
示例#10
0
        public static string GetTableName(Type entityType)
        {
            EntityMeta metadata = EntityReflect.GetDefineInfoFromType(entityType);

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

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