本文整理汇总了C#中IObject.isSet方法的典型用法代码示例。如果您正苦于以下问题:C# IObject.isSet方法的具体用法?C# IObject.isSet怎么用?C# IObject.isSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IObject
的用法示例。
在下文中一共展示了IObject.isSet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetName
public string GetName(IObject element)
{
// Returns the name by the uml logic.
var dataLayer = _dataLayerLogic?.GetDataLayerOfObject(element);
var metaLayer = _dataLayerLogic?.GetMetaLayerFor(dataLayer);
var uml = _dataLayerLogic?.Get<_UML>(metaLayer);
if (uml != null && element.isSet(_UML._CommonStructure._NamedElement.name))
{
var result = element.get(_UML._CommonStructure._NamedElement.name);
if (result != null)
{
return result.ToString();
}
}
// If the element is not uml induced or the property is empty, check by
// the default "name" property
if (element.isSet("name"))
{
return element.get("name").ToString();
}
// Ok, finally, we don't know what to do, so request retrieve the name just via ToString
return element.ToString();
}
示例2: IsProperty
public bool IsProperty(IObject element)
{
var attributeXmi = "{" + Namespaces.Xmi + "}type";
return element.isSet(attributeXmi) &&
element.get(attributeXmi).ToString() == "uml:Property";
}
示例3: GetName
public static string GetName(IObject value)
{
if (value.isSet("name"))
{
return value.get("name").ToString();
}
return null;
}
示例4: ConvertToJson
/// <summary>
/// Converts a given element to a json string, dependent on the column definition as given by the
/// ColumnCreationResult
/// </summary>
/// <param name="element"></param>
/// <param name="creatorResult"></param>
/// <returns></returns>
private Dictionary<string, object> ConvertToJson(IObject element, ColumnCreationResult creatorResult)
{
var result = new Dictionary<string, object>();
foreach (var property in creatorResult.Properties
.Where(property => element.isSet(property)))
{
var propertyAsString = ColumnCreator.ConvertPropertyToColumnName(property);
var propertyValue = element.get(property);
if (creatorResult.ColumnsOnProperty[property].isEnumeration)
{
if (propertyValue is IEnumerable && !(propertyValue is string))
{
var list = new List<object>();
foreach (var listValue in (propertyValue as IEnumerable))
{
var asElement = listValue as IElement;
string url;
if (asElement != null)
{
url = asElement.GetUri();
}
else
{
url = null;
}
list.Add(new
{
u = url,
v = listValue == null ? "null" : _resolution.GetName(listValue)
});
}
result[propertyAsString] = list;
}
else
{
result[propertyAsString] = propertyValue == null ? "null" : _resolution.GetName(propertyValue);
}
}
else
{
result[propertyAsString] = propertyValue == null ? "null" : _resolution.GetName(propertyValue);
}
}
return result;
}