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);
        }
        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]);
        }
        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]);
        }
        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]);
        }
        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]);
        }
Beispiel #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]);
        }
Beispiel #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]);
        }
        public static string GetDeleteSqlByChangeProperty(BaseEntity model, ORMDBType dbType)
        {
            EntityMeta metadeta = EntityReflect.GetDefineInfoFromType(model.GetType());

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

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

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

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