コード例 #1
0
ファイル: Inserter.cs プロジェクト: zhangb12465/AutoCSer
            /// <summary>
            /// 获取逗号分割的列名集合
            /// </summary>
            /// <param name="sqlStream"></param>
            /// <param name="memberMap"></param>
            /// <param name="constantConverter"></param>
            public static void GetColumnNames(CharStream sqlStream, MemberMap memberMap, ConstantConverter constantConverter)
            {
                int isNext = 0;

                foreach (Field member in Fields)
                {
                    if (memberMap.IsMember(member.MemberMapIndex) || member == Identity || member.DataMember.PrimaryKeyIndex != 0)
                    {
                        if (isNext == 0)
                        {
                            isNext = 1;
                        }
                        else
                        {
                            sqlStream.Write(',');
                        }
                        if (member.IsSqlColumn)
                        {
                            sqlStream.SimpleWriteNotNull(ColumnGroup.Inserter.GetColumnNames(member.FieldInfo.FieldType)(member.FieldInfo.Name));
                        }
                        else
                        {
                            constantConverter.ConvertNameToSqlStream(sqlStream, member.FieldInfo.Name);
                        }
                    }
                }
            }
コード例 #2
0
            /// <summary>
            /// 获取逗号分割的列名集合
            /// </summary>
            /// <param name="sqlStream"></param>
            /// <param name="memberMap"></param>
            /// <param name="constantConverter"></param>
            public static void GetColumnNames(CharStream sqlStream, MemberMap memberMap, ConstantConverter constantConverter)
            {
                int isNext = 0;

                foreach (Field member in Fields)
                {
                    if (memberMap.IsMember(member.MemberMapIndex) || member == Identity || member.DataMember.PrimaryKeyIndex != 0)
                    {
                        if (isNext == 0)
                        {
                            isNext = 1;
                        }
                        else
                        {
                            sqlStream.Write(',');
                        }
                        if (member.IsSqlColumn)
                        {
                            sqlStream.SimpleWrite(((Func <string, string>)AutoCSer.Sql.Metadata.GenericType.Get(member.FieldInfo.FieldType).InserterGetColumnNamesMethod)(member.FieldInfo.Name));
                        }
                        else
                        {
                            constantConverter.ConvertNameToSqlStream(sqlStream, member.FieldInfo.Name);
                        }
                    }
                }
            }
コード例 #3
0
ファイル: Model.cs プロジェクト: AutoCSer/AutoCSer
        /// <summary>
        /// 获取以逗号分割的名称集合
        /// </summary>
        /// <param name="sqlStream"></param>
        /// <param name="memberMap"></param>
        /// <param name="constantConverter"></param>
        internal static void GetNames(CharStream sqlStream, MemberMap <modelType> memberMap, ConstantConverter constantConverter)
        {
            int isNext = 0;

            foreach (Field field in Fields)
            {
                if (memberMap.IsMember(field.MemberMapIndex))
                {
                    if (isNext == 0)
                    {
                        isNext = 1;
                    }
                    else
                    {
                        sqlStream.Write(',');
                    }
                    if (field.IsSqlColumn)
                    {
                        sqlStream.SimpleWrite(field.GetSqlColumnName());
                    }
                    else
                    {
                        constantConverter.ConvertNameToSqlStream(sqlStream, field.FieldInfo.Name);
                    }
                }
            }
        }