本文整理汇总了C#中IAttributeDefinition类的典型用法代码示例。如果您正苦于以下问题:C# IAttributeDefinition类的具体用法?C# IAttributeDefinition怎么用?C# IAttributeDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IAttributeDefinition类属于命名空间,在下文中一共展示了IAttributeDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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");
}
开发者ID:loubo,项目名称:sones,代码行数:31,代码来源:MaxWeightFunc.cs
示例2: ResolveAttribute
private IAttributeDefinition ResolveAttribute(string token, IAttributeDefinition result) {
if(result == null && token != null) {
result = meta.GetAttributeDefinition(token);
}
return result;
}
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:7,代码来源:AssetType.cs
示例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;
}
开发者ID:anukat2015,项目名称:sones,代码行数:7,代码来源:SelectionElement.cs
示例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());
}
开发者ID:loubo,项目名称:sones,代码行数:32,代码来源:InsertFunc.cs
示例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.");
}
}
开发者ID:loubo,项目名称:sones,代码行数:28,代码来源:CountFunc.cs
示例6: IndexOf
private int IndexOf(IAttributeDefinition attribdef)
{
for (int i=0;i<_terms.Count;i++)
if (_terms[i].AttributeDefinition == attribdef)
return i;
return -1;
}
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:7,代码来源:OrderBy.cs
示例7: Remove
private void Remove(IAttributeDefinition attribdef)
{
int index = IndexOf(attribdef);
if (index == -1)
return;
_terms.RemoveAt(index);
}
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:7,代码来源:OrderBy.cs
示例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);
}
}
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:12,代码来源:Asset.cs
示例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);
}
开发者ID:baikangwang,项目名称:TJVISA,代码行数:8,代码来源:IBaseObject.cs
示例10: ResolveAttributeDefinition
private IAttributeDefinition ResolveAttributeDefinition(IAttributeDefinition attribdef) {
try {
if(AssetType.Is(attribdef.AssetType)) {
return AssetType.GetAttributeDefinition(attribdef.Name);
}
} catch (MetaException) { }
return attribdef;
}
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:9,代码来源:Asset.cs
示例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;
}
开发者ID:baikangwang,项目名称:TJVISA,代码行数:9,代码来源:IBaseObject.cs
示例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);
}
开发者ID:anukat2015,项目名称:sones,代码行数:11,代码来源:SubstringFunc.cs
示例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());
}
}
开发者ID:anukat2015,项目名称:sones,代码行数:11,代码来源:ToLowerFunc.cs
示例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);
}
}
开发者ID:anukat2015,项目名称:sones,代码行数:11,代码来源:ServiceAttributeDefinition.cs
示例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);
}
}
开发者ID:loubo,项目名称:sones,代码行数:11,代码来源:Exists.cs
示例16: Validate
/// <summary>
/// Validate single Asset attribute. If attribute is not loaded, it is just considered invalid.
/// </summary>
/// <param name="asset">Asset to validate</param>
/// <param name="attributeDefinition">Attribute definition of validated attribute</param>
/// <returns>Validation result</returns>
// TODO create separate private method to avoid excessive GetRequiredFields() calls
public bool Validate(Asset asset, IAttributeDefinition attributeDefinition)
{
GetRequiredFields(asset.AssetType);
asset.EnsureAttribute(attributeDefinition);
Attribute attribute = asset.GetAttribute(attributeDefinition);
bool result = attribute != null && !(IsMultiValueAndUnfilled(attribute) || IsSingleValueAndUnfilled(attribute));
if (!result && attribute != null)
{
result = !attribute.HasChanged && !isAttributeUnfilledOnServer(asset, attributeDefinition);
}
return result;
}
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:21,代码来源:RequiredFieldValidator.cs
示例17: BuildOrderBy
internal OrderBy BuildOrderBy(IAssetType assetType, IAttributeDefinition defaultOrderBy) {
var order = new OrderBy();
if (OrderBy.Count > 0) {
foreach(var s in OrderBy) {
order.MinorSort(assetType.GetAttributeDefinition(ResolvePropertyName(s)), APIClient.OrderBy.Order.Ascending);
}
} else {
if(defaultOrderBy != null) {
order.MinorSort(defaultOrderBy, APIClient.OrderBy.Order.Ascending);
}
}
return order;
}
开发者ID:bigjonroberts,项目名称:VersionOne.SDK.NET.ObjectModel,代码行数:15,代码来源:EntityFilter.cs
示例18: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, TransactionToken myTransactionToken, params FuncParameter[] myParams)
{
if (myCallingObject is UInt64)
{
var dtValue = Convert.ToDateTime((UInt64)myCallingObject);
return new FuncParameter((Int64)UNIXTimeConversionExtension.ToUnixTimeStamp(dtValue));
}
else if (myCallingObject is DateTime)
{
return new FuncParameter(UNIXTimeConversionExtension.ToUnixTimeStamp((DateTime)myCallingObject));
}
else
{
throw new InvalidTypeException(myCallingObject.GetType().ToString(), "DateTime");
}
}
开发者ID:loubo,项目名称:sones,代码行数:16,代码来源:ToUNIXDate.cs
示例19: Query
public Query(IAssetType assetType, bool historical, IAttributeDefinition parentRelation) {
Find = null;
this.assetType = assetType;
isHistorical = historical;
oid = Oid.Null;
this.parentRelation = parentRelation;
if (this.parentRelation != null) {
if(this.parentRelation.AttributeType != AttributeType.Relation) {
throw new ApplicationException("Parent Relation must be a Relation Attribute Type");
}
if(this.parentRelation.IsMultiValue) {
throw new ApplicationException("Parent Relation cannot be multi-value");
}
}
}
开发者ID:RedwardsiPipeline,项目名称:VersionOne.SDK.NET.APIClient,代码行数:17,代码来源:Query.cs
示例20: ExecFunc
public override FuncParameter ExecFunc(IAttributeDefinition myAttributeDefinition, Object myCallingObject, IVertex myDBObject, IGraphDB myGraphDB, SecurityToken mySecurityToken, Int64 myTransactionToken, params FuncParameter[] myParams)
{
if (myCallingObject != null)
{
if (myCallingObject is Int64)
{
return new FuncParameter(UNIXTimeConversionExtension.FromUnixTimeStamp((Int64)myCallingObject));
}
else
{
throw new InvalidTypeException(myCallingObject.GetType().Name, "Int64");
}
}
else
{
throw new NotImplementedException();
}
}
开发者ID:anukat2015,项目名称:sones,代码行数:18,代码来源:FromUNIXDate.cs
注:本文中的IAttributeDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论