當前位置: 首頁>>代碼示例>>C#>>正文


C# DataTable.ShouldSerializeCaseSensitive方法代碼示例

本文整理匯總了C#中System.Data.DataTable.ShouldSerializeCaseSensitive方法的典型用法代碼示例。如果您正苦於以下問題:C# DataTable.ShouldSerializeCaseSensitive方法的具體用法?C# DataTable.ShouldSerializeCaseSensitive怎麽用?C# DataTable.ShouldSerializeCaseSensitive使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Data.DataTable的用法示例。


在下文中一共展示了DataTable.ShouldSerializeCaseSensitive方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: HandleTable

        internal XmlElement HandleTable(DataTable table, XmlDocument dc, XmlElement schema, bool genNested) {
            XmlElement root = dc.CreateElement(Keywords.XSD_PREFIX, Keywords.XSD_ELEMENT, Keywords.XSDNS);
            bool fWriteOrdinals = false;
            bool fUnqualified = false;

            if (((table.DataSet == null) || (_ds!= null &&  table.Namespace != _ds.Namespace)) && (schFormat == SchemaFormat.Remoting))
                root.SetAttribute( Keywords.TARGETNAMESPACE, Keywords.MSDNS, table.Namespace);

            // First add any attributes.
            root.SetAttribute( Keywords.NAME, table.EncodedTableName );

            if (table.Namespace.Length == 0) {
                DataTable _table = table;
                string tgNamespace = _table.Namespace;
                while (Common.ADP.IsEmpty(tgNamespace)) {
                    DataRelation [] nestedParentRelations = _table.NestedParentRelations;
                    if (nestedParentRelations.Length == 0){
                        tgNamespace = (_ds != null) ?_ds.Namespace : "";
                        break;
                    }
                    int nestedparentPosition = -1; // it is find non-self-nested-parent
                    for(int i = 0; i < nestedParentRelations.Length; i++) {
                        if (nestedParentRelations[i].ParentTable != _table) {
                            nestedparentPosition = i;
                            break;
                        }
                    }
                    if (nestedparentPosition == -1) {
                        break;
                    }
                    else {
                        _table = nestedParentRelations[nestedparentPosition].ParentTable;
                    }
                    tgNamespace = _table.Namespace;
                }

                if (table.Namespace != tgNamespace) {
                    root.SetAttribute( Keywords.FORM, Keywords.UNQUALIFIED);
                    fUnqualified = true;
                }

            }


            if (table.ShouldSerializeCaseSensitive()) {
                root.SetAttribute(Keywords.MSD_CASESENSITIVE, Keywords.MSDNS, table.CaseSensitive.ToString(CultureInfo.InvariantCulture));
            }
            if (table.ShouldSerializeLocale()) {
                root.SetAttribute(Keywords.MSD_LOCALE, Keywords.MSDNS, table.Locale.ToString());
            }

            AddXdoProperties(table, root, dc);

            DataColumnCollection columns = table.Columns;

            int cCount = columns.Count;
            int realCount = 0;

            if (cCount ==1 || cCount ==2)
                for (int i = 0; i < cCount; i++) {
                    DataColumn col = columns[i];

                    if (col.ColumnMapping == MappingType.Hidden) {
                        DataRelationCollection childRelations = table.ChildRelations;
                        for (int j = 0; j < childRelations.Count; j++) {
                            if (childRelations[j].Nested && childRelations[j].ParentKey.ColumnsReference.Length == 1 && childRelations[j].ParentKey.ColumnsReference[0] == col)
                                    realCount++;
                        }
                    }

                    if (col.ColumnMapping == MappingType.Element)
                        realCount++;
                }


            if ((table.repeatableElement) && (realCount ==1)) {
                // I only have 1 column and that gives me
                // the type for this element
                DataColumn col = table.Columns[0];
                string _typeName = XmlDataTypeName(col.DataType);
                if (_typeName == null || _typeName.Length == 0) {
                    _typeName = Keywords.XSD_ANYTYPE;
                }

                root.SetAttribute(Keywords.TYPE, XSDSchema.QualifiedName(_typeName));
                return root;
            }

            // Now add the type information nested inside the element or global.
            XmlElement type = dc.CreateElement(Keywords.XSD_PREFIX, Keywords.XSD_COMPLEXTYPE, Keywords.XSDNS);

            if (!table.TypeName.IsEmpty && schFormat != SchemaFormat.Remoting) {
                XmlElement typeSchema = GetSchema(table.TypeName.Namespace);
                if (Common.ADP.IsEmpty(table.TypeName.Namespace)) {
                    if (_ds == null)
                        typeSchema = GetSchema(table.Namespace);
                    else
                        typeSchema = fUnqualified ? GetSchema(_ds.Namespace): GetSchema(table.Namespace);
                }

//.........這裏部分代碼省略.........
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:101,代碼來源:xmlsaver.cs

示例2: CreateTypedTable


//.........這裏部分代碼省略.........
                        tableInitClass.Statements.Add(Assign(Property(codeField, "AllowDBNull"), Primitive(false)));
                    }
                    if (column.ReadOnly) {
                        //\\ this.column<ColumnName>.ReadOnly = true;
                        tableInitClass.Statements.Add(Assign(Property(codeField, "ReadOnly"), Primitive(true)));
                    }
                    if (column.Unique) {
                        //\\ this.column<ColumnName>.Unique = true;
                        tableInitClass.Statements.Add(Assign(Property(codeField, "Unique"), Primitive(true)));
                    }

                    if (!Common.ADP.IsEmpty(column.Prefix)) {
                        //\\ this.column<ColumnName>.Prefix = "<column.Prefix>";
                        tableInitClass.Statements.Add(Assign(Property(codeField, "Prefix"), Str(column.Prefix)));
                    }
                    if (column._columnUri != null) {
                        //\\ this.column<ColumnName>.Namespace = "<column.Namespace>";
                        tableInitClass.Statements.Add(Assign(Property(codeField, "Namespace"), Str(column.Namespace)));
                    }
                    if (column.Caption != column.ColumnName) {
                        //\\ this.column<ColumnName>.Caption = "<column.Caption>";
                        tableInitClass.Statements.Add(Assign(Property(codeField, "Caption"), Str(column.Caption)));
                    }
                    if (column.DefaultValue != DBNull.Value) {
                        //\\ this.column<ColumnName>.DefaultValue = "<column.DefaultValue>";
                        tableInitClass.Statements.Add(Assign(Property(codeField, "DefaultValue"), Primitive(column.DefaultValue)));
                    }
                    if (column.MaxLength != -1) {
                        //\\ this.column<ColumnName>.MaxLength = "<column.MaxLength>";
                        tableInitClass.Statements.Add(Assign(Property(codeField, "MaxLength"), Primitive(column.MaxLength)));
                    }
                }

                if (table.ShouldSerializeCaseSensitive()) {
                    //\\ this.CaseSensitive = <CaseSensitive>;
                    tableInitClass.Statements.Add(Assign(Property(This(), "CaseSensitive"), Primitive(table.CaseSensitive)));
                }
                if (table.ShouldSerializeLocale()) {
                    //\\ this.Locale = new System.Globalization.CultureInfo("<Locale>");
                    tableInitClass.Statements.Add(Assign(Property(This(), "Locale"), New(typeof(System.Globalization.CultureInfo),new CodeExpression[] {Str(table.Locale.ToString())})));
                }
                if (!Common.ADP.IsEmpty(table.Prefix)) {
                    //\\ this.Prefix = "<Prefix>";
                    tableInitClass.Statements.Add(Assign(Property(This(), "Prefix"), Str(table.Prefix)));
                }
                if (table.tableNamespace != null) {
                    //\\ this.Namespace = <Namespace>;
                    tableInitClass.Statements.Add(Assign(Property(This(), "Namespace"), Str(table.Namespace)));
                }

                if (table.MinimumCapacity != 50) {
                    //\\ this.MinimumCapacity = <MinimumCapacity>;
                    tableInitClass.Statements.Add(Assign(Property(This(), "MinimumCapacity"), Primitive(table.MinimumCapacity)));
                }
                if (table.displayExpression != null) {
                    //\\ this.DisplayExpression = "<DisplayExpression>";
                    tableInitClass.Statements.Add(Assign(Property(This(), "DisplayExpression"), Str(table.DisplayExpressionInternal)));
                }
            }
            dataTableClass.Members.Add(tableInitVars);
            }
            dataTableClass.Members.Add(tableInitClass);

            //\\ public <RowClassName> New<RowClassName>() {
            //\\     return (<RowClassName>) NewRow();
            //\\ }
開發者ID:uQr,項目名稱:referencesource,代碼行數:67,代碼來源:datacache.cs

示例3: HandleTable

 internal XmlElement HandleTable(DataTable table, XmlDocument dc, XmlElement schema, bool genNested)
 {
     XmlElement root = dc.CreateElement("xs", "element", "http://www.w3.org/2001/XMLSchema");
     bool fWriteOrdinal = false;
     bool flag = false;
     if (((table.DataSet == null) || ((this._ds != null) && (table.Namespace != this._ds.Namespace))) && (this.schFormat == SchemaFormat.Remoting))
     {
         root.SetAttribute("targetNamespace", "urn:schemas-microsoft-com:xml-msdata", table.Namespace);
     }
     root.SetAttribute("name", table.EncodedTableName);
     if (table.Namespace.Length == 0)
     {
         DataTable parentTable = table;
         string str3 = parentTable.Namespace;
         while (ADP.IsEmpty(str3))
         {
             DataRelation[] nestedParentRelations = parentTable.NestedParentRelations;
             if (nestedParentRelations.Length == 0)
             {
                 str3 = (this._ds != null) ? this._ds.Namespace : "";
                 break;
             }
             int index = -1;
             for (int k = 0; k < nestedParentRelations.Length; k++)
             {
                 if (nestedParentRelations[k].ParentTable != parentTable)
                 {
                     index = k;
                     break;
                 }
             }
             if (index == -1)
             {
                 break;
             }
             parentTable = nestedParentRelations[index].ParentTable;
             str3 = parentTable.Namespace;
         }
         if (table.Namespace != str3)
         {
             root.SetAttribute("form", "unqualified");
             flag = true;
         }
     }
     if (table.ShouldSerializeCaseSensitive())
     {
         root.SetAttribute("CaseSensitive", "urn:schemas-microsoft-com:xml-msdata", table.CaseSensitive.ToString(CultureInfo.InvariantCulture));
     }
     if (table.ShouldSerializeLocale())
     {
         root.SetAttribute("Locale", "urn:schemas-microsoft-com:xml-msdata", table.Locale.ToString());
     }
     this.AddXdoProperties(table, root, dc);
     DataColumnCollection columns = table.Columns;
     int count = columns.Count;
     int num7 = 0;
     switch (count)
     {
         case 1:
         case 2:
             for (int m = 0; m < count; m++)
             {
                 DataColumn column3 = columns[m];
                 if (column3.ColumnMapping == MappingType.Hidden)
                 {
                     DataRelationCollection childRelations = table.ChildRelations;
                     for (int n = 0; n < childRelations.Count; n++)
                     {
                         if ((childRelations[n].Nested && (childRelations[n].ParentKey.ColumnsReference.Length == 1)) && (childRelations[n].ParentKey.ColumnsReference[0] == column3))
                         {
                             num7++;
                         }
                     }
                 }
                 if (column3.ColumnMapping == MappingType.Element)
                 {
                     num7++;
                 }
             }
             break;
     }
     if (table.repeatableElement && (num7 == 1))
     {
         DataColumn column4 = table.Columns[0];
         string name = XmlDataTypeName(column4.DataType);
         if ((name == null) || (name.Length == 0))
         {
             name = "anyType";
         }
         root.SetAttribute("type", XSDSchema.QualifiedName(name));
         return root;
     }
     XmlElement newChild = dc.CreateElement("xs", "complexType", "http://www.w3.org/2001/XMLSchema");
     if (!table.TypeName.IsEmpty && (this.schFormat != SchemaFormat.Remoting))
     {
         XmlElement node = this.GetSchema(table.TypeName.Namespace);
         if (ADP.IsEmpty(table.TypeName.Namespace))
         {
             if (this._ds == null)
             {
//.........這裏部分代碼省略.........
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:101,代碼來源:XmlTreeGen.cs

示例4: CreateTypedTable


//.........這裏部分代碼省略.........
             method.Statements.Add(MethodCall(Property(This(), "Constraints"), "Add", New(typeof(UniqueConstraint), new CodeExpression[] { Str(constraint.ConstraintName), new CodeArrayCreateExpression(typeof(DataColumn), initializers), Primitive(constraint.IsPrimaryKey) })));
         }
     }
     for (int num9 = 0; num9 < table.Columns.Count; num9++)
     {
         DataColumn column = table.Columns[num9];
         string str7 = this.TableColumnFieldName(column);
         CodeExpression expression = Field(This(), str7);
         method11.Statements.Add(Assign(expression, Indexer(Property(This(), "Columns"), Str(column.ColumnName))));
         if (column.AutoIncrement)
         {
             method.Statements.Add(Assign(Property(expression, "AutoIncrement"), Primitive(true)));
         }
         if (column.AutoIncrementSeed != 0L)
         {
             method.Statements.Add(Assign(Property(expression, "AutoIncrementSeed"), Primitive(column.AutoIncrementSeed)));
         }
         if (column.AutoIncrementStep != 1L)
         {
             method.Statements.Add(Assign(Property(expression, "AutoIncrementStep"), Primitive(column.AutoIncrementStep)));
         }
         if (!column.AllowDBNull)
         {
             method.Statements.Add(Assign(Property(expression, "AllowDBNull"), Primitive(false)));
         }
         if (column.ReadOnly)
         {
             method.Statements.Add(Assign(Property(expression, "ReadOnly"), Primitive(true)));
         }
         if (column.Unique)
         {
             method.Statements.Add(Assign(Property(expression, "Unique"), Primitive(true)));
         }
         if (!ADP.IsEmpty(column.Prefix))
         {
             method.Statements.Add(Assign(Property(expression, "Prefix"), Str(column.Prefix)));
         }
         if (column._columnUri != null)
         {
             method.Statements.Add(Assign(Property(expression, "Namespace"), Str(column.Namespace)));
         }
         if (column.Caption != column.ColumnName)
         {
             method.Statements.Add(Assign(Property(expression, "Caption"), Str(column.Caption)));
         }
         if (column.DefaultValue != DBNull.Value)
         {
             method.Statements.Add(Assign(Property(expression, "DefaultValue"), Primitive(column.DefaultValue)));
         }
         if (column.MaxLength != -1)
         {
             method.Statements.Add(Assign(Property(expression, "MaxLength"), Primitive(column.MaxLength)));
         }
     }
     if (table.ShouldSerializeCaseSensitive())
     {
         method.Statements.Add(Assign(Property(This(), "CaseSensitive"), Primitive(table.CaseSensitive)));
     }
     if (table.ShouldSerializeLocale())
     {
         method.Statements.Add(Assign(Property(This(), "Locale"), New(typeof(CultureInfo), new CodeExpression[] { Str(table.Locale.ToString()) })));
     }
     if (!ADP.IsEmpty(table.Prefix))
     {
         method.Statements.Add(Assign(Property(This(), "Prefix"), Str(table.Prefix)));
     }
     if (table.tableNamespace != null)
     {
         method.Statements.Add(Assign(Property(This(), "Namespace"), Str(table.Namespace)));
     }
     if (table.MinimumCapacity != 50)
     {
         method.Statements.Add(Assign(Property(This(), "MinimumCapacity"), Primitive(table.MinimumCapacity)));
     }
     if (table.displayExpression != null)
     {
         method.Statements.Add(Assign(Property(This(), "DisplayExpression"), Str(table.DisplayExpressionInternal)));
     }
     declaration.Members.Add(method11);
     declaration.Members.Add(method);
     CodeMemberMethod method10 = MethodDecl(str2, "New" + str, MemberAttributes.Public | MemberAttributes.Final);
     method10.Statements.Add(Return(Cast(str2, MethodCall(This(), "NewRow"))));
     declaration.Members.Add(method10);
     CodeMemberMethod method5 = MethodDecl(typeof(DataRow), "NewRowFromBuilder", MemberAttributes.Family | MemberAttributes.Override);
     method5.Parameters.Add(ParameterDecl(typeof(DataRowBuilder), "builder"));
     method5.Statements.Add(Return(New(str2, new CodeExpression[] { Argument("builder") })));
     declaration.Members.Add(method5);
     CodeMemberMethod method9 = MethodDecl(typeof(System.Type), "GetRowType", MemberAttributes.Family | MemberAttributes.Override);
     method9.Statements.Add(Return(TypeOf(str2)));
     declaration.Members.Add(method9);
     declaration.Members.Add(CreateOnRowEventMethod("Changed", str));
     declaration.Members.Add(CreateOnRowEventMethod("Changing", str));
     declaration.Members.Add(CreateOnRowEventMethod("Deleted", str));
     declaration.Members.Add(CreateOnRowEventMethod("Deleting", str));
     CodeMemberMethod method4 = MethodDecl(typeof(void), "Remove" + str, MemberAttributes.Public | MemberAttributes.Final);
     method4.Parameters.Add(ParameterDecl(str2, "row"));
     method4.Statements.Add(MethodCall(Property(This(), "Rows"), "Remove", Argument("row")));
     declaration.Members.Add(method4);
     return declaration;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:101,代碼來源:TypedDataSetGenerator.cs


注:本文中的System.Data.DataTable.ShouldSerializeCaseSensitive方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。