当前位置: 首页>>代码示例>>C#>>正文


C# Proxy.query方法代码示例

本文整理汇总了C#中System.Proxy.query方法的典型用法代码示例。如果您正苦于以下问题:C# Proxy.query方法的具体用法?C# Proxy.query怎么用?C# Proxy.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Proxy的用法示例。


在下文中一共展示了Proxy.query方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateObjectDefinition

        protected DataObject CreateObjectDefinition(Proxy proxy, ClassObject classObject)
        {
            if (classObject.Ids == null || classObject.Ids.Count == 0)
              {
            return null;
              }

              string metadataQuery = string.Empty;

              if (classObject.ObjectType == ObjectType.Tag)
              {
            metadataQuery = string.Format(TAG_METADATA_SQL, (int)ObjectType.Tag);
              }
              else if (classObject.ObjectType == ObjectType.Document)
              {
            metadataQuery = string.Format(DOCUMENT_METADATA_SQL, (int)ObjectType.Document);
              }
              else
              {
            throw new Exception(string.Format("Object type [{0}] not supported.", classObject.ObjectType));
              }

              int status = 0;
              string result = proxy.query(metadataQuery, ref status);
              XmlDocument resultXml = new XmlDocument();
              resultXml.LoadXml(result);

              string type = Enum.GetName(typeof(ObjectType), classObject.ObjectType);
              DataObject objDef = new DataObject();
              objDef.objectNamespace = type;
              objDef.objectName = classObject.Name + "(" + type + ")";
              objDef.tableName = string.Join("_", classObject.Ids.ToArray());
              objDef.keyDelimeter = _keyDelimiter;

              Configuration config = GetConfiguration(objDef);
              if (config == null)
            return null;

              Map codeMap = config.Mappings.ToList<Map>().Find(x => x.Destination == (int)Destination.Code);
              if (codeMap == null)
              {
            throw new Exception("No mapping configured for key property.");
              }

              objDef.keyProperties = new List<KeyProperty>()
              {
            new KeyProperty() { keyPropertyName = codeMap.Column }
              };

              foreach (XmlNode attrNode in resultXml.DocumentElement.ChildNodes)
              {
            DataProperty dataProp = new DataProperty();
            dataProp.columnName = attrNode.SelectSingleNode("char_name").InnerText;

            string propertyName = Utilities.ToPropertyName(dataProp.columnName);
            if (objDef.dataProperties.Find(x => x.propertyName == propertyName) != null)
              continue;

            dataProp.propertyName = propertyName;
            dataProp.dataType = Utilities.ToCSharpType(attrNode.SelectSingleNode("char_data_type").InnerText);
            dataProp.dataLength = Int32.Parse(attrNode.SelectSingleNode("char_length").InnerText);

            if (attrNode.SelectSingleNode("is_system_char").InnerText == "1")
            {
              dataProp.columnName += Utilities.SYSTEM_ATTRIBUTE_TOKEN;
            }
            else
            {
              dataProp.columnName += Utilities.USER_ATTRIBUTE_TOKEN;
            }

            objDef.dataProperties.Add(dataProp);
              }

              // add related properties
              foreach (Map m in config.Mappings.Where(x => x.Destination == (int)Destination.Relationship).Select(m => m))
              {
            DataProperty dataProp = new DataProperty();
            string propertyName = Utilities.ToPropertyName(m.Column);
            DataProperty checkProp = objDef.dataProperties.Find(x => x.propertyName == propertyName);

            if (checkProp != null)  // property already exists, update its column name
            {
              checkProp.columnName = m.Column + Utilities.RELATED_ATTRIBUTE_TOKEN;
            }
            else
            {
              dataProp.columnName = m.Column + Utilities.RELATED_ATTRIBUTE_TOKEN;
              dataProp.propertyName = propertyName;
              dataProp.dataType = DataType.String;
              objDef.dataProperties.Add(dataProp);
            }
              }

              // add other properties
              foreach (Map m in config.Mappings.Where(x => x.Destination != (int)Destination.Relationship &&
            x.Destination != (int)Destination.Attribute && x.Destination != (int)Destination.None).Select(m => m))
              {
            DataProperty dataProp = new DataProperty();
            string propertyName = Utilities.ToPropertyName(m.Column);
//.........这里部分代码省略.........
开发者ID:Vidisha,项目名称:eb,代码行数:101,代码来源:ebDataLayer.cs


注:本文中的System.Proxy.query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。