Пример #1
0
        /// <summary>
        /// Assign a key/value property to the edge.
        /// If a value already exists for this key, then the previous key/value is overwritten.
        /// </summary>
        /// <param name="key">the string key of the property</param>
        /// <param name="value">the object value o the property</param>
        public override void SetProperty(string key, object value)
        {
            if (key == null || key.Length == 0)
            {
                throw new ArgumentException("Property key may not be null or be an empty string");
            }
            if (value == null)
            {
                throw new ArgumentException("Property value may not be null");
            }
            if (key.Equals(StringFactory.Id))
            {
                throw ExceptionFactory.PropertyKeyIdIsReserved();
            }
            PropertyType pt = edgeType.FindProperty(key);

            if (pt == null)
            {
                pt = edgeType.NewProperty(key, value, PropertyKind.Indexed);
            }
            edgeType.SetPropertyValue(EdgeId, pt, (IComparable)value);
        }
Пример #2
0
 /// <summary>
 /// Creates a new Property.
 /// </summary>
 /// <param name="type">Node or edge type identifier.</param>
 /// <param name="name">Unique name for the new Property.</param>
 /// <param name="dt">Data type for the new Property.</param>
 /// <param name="kind">Property kind.</param>
 /// <returns>Unique Property identifier.</returns>
 public PropertyType NewEdgeProperty(EdgeType edgeType, string name, DataType dt, PropertyKind kind)
 {
     return(edgeType.NewProperty(name, dt, kind));
 }