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


C# IAttributeDefinition类代码示例

本文整理汇总了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");
        }
开发者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


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