Example #1
0
        private static MsGenerateSql Join <T1, T2>(JoinType joinType, string OnCondition)
        {
            Type A = typeof(T1);
            Type B = typeof(T2);

            JoinRelationship item = new JoinRelationship();

            item.JoinTableName   = A.Name;             //Join 表的名称
            item.OnCondition     = OnCondition;        //Join条件
            item.JoinTableAsName = item.JoinTableName; //Join表的别名
            item.joinType        = joinType;           //Join类型 例如 Left Join ,Right Join ,Inner Join

            if (jrsList.Find(x => x.JoinTableName == item.JoinTableName) != null)
            {
                item.JoinTableAsName = item.JoinTableAsName + "COPY";//防止表别名重复
            }

            Dictionary <string, string> tempMap = EE.GetAllEntityPropertyName <T1>();

            foreach (var temp in tempMap)
            {
                if (!displayItemMap.ContainsKey(temp.Key))
                {
                    displayItemMap.Add(temp.Key, temp.Value);
                }
            }


            jrsList.Add(item);

            return(sqlObject);
        }
Example #2
0
        public static MsGenerateSql SelectFromTable <T>()
        {
            Type Root = typeof(T);

            msSQL = new MSSQL();

            msSQL.displayItem = "";
            msSQL.whereSql    = "";
            msSQL.rootTable   = "";
            msSQL.headCmd     = "";

            displayItemMap.Clear();

            msSQL.rootTable = Root.Name;

            Dictionary <string, string> tempMap = EE.GetAllEntityPropertyName <T>();

            foreach (var temp in tempMap)
            {
                if (!displayItemMap.ContainsKey(temp.Key))
                {
                    displayItemMap.Add(temp.Key, temp.Value);
                }
            }

            return(sqlObject);
        }
Example #3
0
        public MsGenerateSql AutoMapDisplayItem <T>()
        {
            Dictionary <string, string> tempMap = EE.GetAllEntityPropertyName <T>();

            foreach (var temp in tempMap)
            {
                if (displayItemMap.ContainsKey(temp.Key))
                {
                    msSQL.displayItem = msSQL.displayItem + " " + "[" + displayItemMap[temp.Key] + "].[" + temp.Key + "]" + endDisplayFormat;
                }
            }

            return(sqlObject);
        }