本文整理汇总了C#中IAttributeDefinition类的典型用法代码示例。如果您正苦于以下问题:C# IAttributeDefinition类的具体用法?C# IAttributeDefinition怎么用?C# IAttributeDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IAttributeDefinition类属于命名空间,在下文中一共展示了IAttributeDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecFunc
/// <summary>
/// Executes the function on myCallingObject
/// </summary>
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
var currentInnerEdgeType = ((IOutgoingEdgeDefinition)myAttributeDefinition).InnerEdgeType;
if (myCallingObject is IHyperEdge && currentInnerEdgeType.HasProperty("Weight"))
{
var hyperEdge = myCallingObject as IHyperEdge;
if (currentInnerEdgeType.HasProperty("Weight"))
{
var weightProperty = currentInnerEdgeType.GetPropertyDefinition("Weight");
var maxWeight = hyperEdge.InvokeHyperEdgeFunc<Double>(singleEdges =>
{
return Convert.ToDouble(
weightProperty.GetValue(
singleEdges
.OrderByDescending(edge => weightProperty.GetValue(edge))
.First()));
});
return new FuncParameter(maxWeight);
}
}
throw new InvalidTypeException(myCallingObject.GetType().ToString(), "Weighted IHyperEdge");
}
示例2: ResolveAttribute
private IAttributeDefinition ResolveAttribute(string token, IAttributeDefinition result) {
if(result == null && token != null) {
result = meta.GetAttributeDefinition(token);
}
return result;
}
示例3: SelectionElement
public SelectionElement(string myAlias, Select.EdgeList myEdgeList, bool myIsGroupedOrAggregated, IDChainDefinition myRelatedIDChainDefinition, IAttributeDefinition myElement = null)
: this(myAlias, myRelatedIDChainDefinition)
{
EdgeList = myEdgeList;
IsGroupedOrAggregated = myIsGroupedOrAggregated;
Element = myElement;
}
示例4: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
if (!(myCallingObject is String))
{
throw new FunctionParameterTypeMismatchException(typeof(String), myCallingObject.GetType());
}
var pos = Convert.ToInt32(myParams[0].Value);
StringBuilder resString = new StringBuilder();
bool dontInsert = false;
if (pos > (myCallingObject as String).Length)
{
dontInsert = true;
resString.Append((myCallingObject as String).ToString());
}
else
{
resString.Append((myCallingObject as String).ToString().Substring(0, pos));
}
foreach (FuncParameter fp in myParams.Skip(1))
{
resString.Append(fp.Value as String);
}
if(!dontInsert)
resString.Append((myCallingObject as String).ToString().Substring(pos));
return new FuncParameter(resString.ToString());
}
示例5: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
if (myCallingObject is IHyperEdge)
{
return new FuncParameter((UInt64)((IHyperEdge)myCallingObject).GetAllEdges().Count());
}
else if (myCallingObject is ISingleEdge)
{
UInt64 count = 1;
return new FuncParameter(count);
}
else if (myCallingObject is IncomingEdgeCollection)
{
return new FuncParameter((UInt64)(myCallingObject as IncomingEdgeCollection).LongCount());
}
else if (myCallingObject is IEnumerable<long>)
{
return new FuncParameter((UInt64)(myCallingObject as IEnumerable<long>).LongCount());
}
else if (myCallingObject is IEnumerable<IVertex>)
{
return new FuncParameter((UInt64)(myCallingObject as IEnumerable<IVertex>).LongCount());
}
else
{
throw new UnknownDBException("Unexpected input for COUNT aggregate.");
}
}
示例6: IndexOf
private int IndexOf(IAttributeDefinition attribdef)
{
for (int i=0;i<_terms.Count;i++)
if (_terms[i].AttributeDefinition == attribdef)
return i;
return -1;
}
示例7: Remove
private void Remove(IAttributeDefinition attribdef)
{
int index = IndexOf(attribdef);
if (index == -1)
return;
_terms.RemoveAt(index);
}
示例8: ClearAttributeCache
/// <summary>
/// Clear an attribute from cache based on definition.
/// </summary>
/// <param name="attribdef">definition of attribute to clear;
/// if null, all attributes will be cleared from cache.</param>
public void ClearAttributeCache(IAttributeDefinition attribdef) {
if (attribdef == null) {
attributes.Clear();
} else {
attributes.Remove(ResolveAttributeDefinition(attribdef).Token);
}
}
示例9: SetValue
public virtual void SetValue(IAttributeDefinition attrDef, object value)
{
Type it = this.GetType();//this.GetType().Assembly.GetType("TJVISA.Entity." + attrDef.ForObject.EntityName,false, true);
if (it == null) Debug.Assert(false, attrDef.ForObject.EntityName + " is unknown object type.");
PropertyInfo p = it.GetProperty(attrDef.Name);
if (p != null && p.CanWrite)
p.SetValue(this, value, null);
}
示例10: ResolveAttributeDefinition
private IAttributeDefinition ResolveAttributeDefinition(IAttributeDefinition attribdef) {
try {
if(AssetType.Is(attribdef.AssetType)) {
return AssetType.GetAttributeDefinition(attribdef.Name);
}
} catch (MetaException) { }
return attribdef;
}
示例11: GetValue
public virtual object GetValue(IAttributeDefinition attrDef)
{
Type it = this.GetType();//this.GetType().Assembly.GetType("TJVISA.Entity." + attrDef.ForObject.EntityName,false, true);
if (it == null) Debug.Assert(false, attrDef.ForObject.EntityName+ " is unknown object type.");
PropertyInfo p = it.GetProperty(attrDef.Name);
if (p != null && p.CanRead)
return p.GetValue(this, null);
return null;
}
示例12: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, Int64 myTransactionToken, params FuncParameter[] myParams)
{
if (!(myCallingObject is String))
{
throw new FunctionParameterTypeMismatchException(typeof(String), myCallingObject.GetType());
}
var substring = myCallingObject.ToString().Substring(Convert.ToInt32(myParams[0].Value), Convert.ToInt32(myParams[1].Value));
return new FuncParameter(substring);
}
示例13: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, Int64 myTransactionToken, params FuncParameter[] myParams)
{
if (myCallingObject is String)
{
return new FuncParameter(((String)myCallingObject).ToLower());
}
else
{
throw new FunctionParameterTypeMismatchException(typeof(String), myCallingObject.GetType());
}
}
示例14: ServiceAttributeDefinition
public ServiceAttributeDefinition(IAttributeDefinition myAttributeDefinition)
{
if (myAttributeDefinition != null)
{
this.ID = myAttributeDefinition.ID;
this.Name = myAttributeDefinition.Name;
this.IsUserDefined = myAttributeDefinition.IsUserDefined;
this.Kind = (ServiceAttributeType)myAttributeDefinition.Kind;
this.RelatedType = ConvertHelper.ToServiceBaseType(myAttributeDefinition.RelatedType);
}
}
示例15: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
if (myCallingObject != null)
{
return new FuncParameter(true);
}
else
{
return new FuncParameter(false);
}
}