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


C# DataColumn.Description方法代碼示例

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


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

示例1: HandleColumn


//.........這裏部分代碼省略.........
             }
             else if (XMLSchema.FEqualIdentity(node, "element", "urn:schemas-microsoft-com:xml-data"))
             {
                 throw ExceptionBuilder.DuplicateDeclaration(str3);
             }
             str4 = XMLSchema.GenUniqueColumnName(str3, table);
         }
     }
     else
     {
         str3 = str4 = "";
     }
     XmlElement element = this.FindTypeNode(node);
     SimpleType type2 = null;
     if (element == null)
     {
         throw ExceptionBuilder.UndefinedDatatype(node.GetAttribute("type"));
     }
     string attribute = element.GetAttribute("type", "urn:schemas-microsoft-com:datatypes");
     string dtValues = element.GetAttribute("values", "urn:schemas-microsoft-com:datatypes");
     if ((attribute == null) || (attribute.Length == 0))
     {
         attribute = "";
         type = typeof(string);
     }
     else
     {
         type = this.ParseDataType(attribute, dtValues);
         if (attribute == "float")
         {
             attribute = "";
         }
         if (attribute == "char")
         {
             attribute = "";
             type2 = SimpleType.CreateSimpleType(type);
         }
         if (attribute == "enumeration")
         {
             attribute = "";
             type2 = SimpleType.CreateEnumeratedType(dtValues);
         }
         if (attribute == "bin.base64")
         {
             attribute = "";
             type2 = SimpleType.CreateByteArrayType("base64");
         }
         if (attribute == "bin.hex")
         {
             attribute = "";
             type2 = SimpleType.CreateByteArrayType("hex");
         }
     }
     bool isAttribute = XMLSchema.FEqualIdentity(node, "attribute", "urn:schemas-microsoft-com:xml-data");
     this.GetMinMax(node, isAttribute, ref minOccurs, ref maxOccurs);
     string str2 = null;
     str2 = node.GetAttribute("default");
     bool flag2 = false;
     column = new DataColumn(XmlConvert.DecodeName(str4), type, null, isAttribute ? MappingType.Attribute : MappingType.Element);
     XMLSchema.SetProperties(column, node.Attributes);
     column.XmlDataType = attribute;
     column.SimpleType = type2;
     column.AllowDBNull = (minOccurs == 0) || flag2;
     column.Namespace = isAttribute ? string.Empty : this._schemaUri;
     if (node.Attributes != null)
     {
         for (int i = 0; i < node.Attributes.Count; i++)
         {
             if ((node.Attributes[i].NamespaceURI == "urn:schemas-microsoft-com:xml-msdata") && (node.Attributes[i].LocalName == "Expression"))
             {
                 column.Expression = node.Attributes[i].Value;
                 break;
             }
         }
     }
     string str5 = node.GetAttribute("targetNamespace");
     if ((str5 != null) && (str5.Length > 0))
     {
         column.Namespace = str5;
     }
     table.Columns.Add(column);
     if ((str2 != null) && (str2.Length != 0))
     {
         try
         {
             column.DefaultValue = SqlConvert.ChangeTypeForXML(str2, type);
         }
         catch (FormatException)
         {
             throw ExceptionBuilder.CannotConvert(str2, type.FullName);
         }
     }
     for (XmlNode node2 = node.FirstChild; node2 != null; node2 = node2.NextSibling)
     {
         if (XMLSchema.FEqualIdentity(node2, "description", "urn:schemas-microsoft-com:xml-data"))
         {
             column.Description(((XmlElement) node2).InnerText);
         }
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:101,代碼來源:XDRSchema.cs


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