本文整理汇总了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);
//.........这里部分代码省略.........