Ejemplo n.º 1
0
 public PropertyHasWrongTypeException(String myDefiningTypeName, String myPropertyName, PropertyMultiplicity myMultiplicity, String myExpectedTypeName)
 {
     DefiningTypeName = myDefiningTypeName;
     PropertyName = myPropertyName;
     ExpectedTypeName = myExpectedTypeName;
     _msg = string.Format("The property {0}.[1} needs a {3} of type {2} but was no {3}", myDefiningTypeName, myPropertyName, myExpectedTypeName, myMultiplicity.ToString());
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a new PropertyPredefinition.
 /// </summary>
 /// <param name="myPropertyName">The name of the property</param>
 public PropertyPredefinition(String myPropertyName, String myPropertyType)
     : base(myPropertyName, myPropertyType)
 {
     IsIndexed = false;
     IsMandatory = false;
     IsUnique = false;
     Multiplicity = PropertyMultiplicity.Single;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates a new PropertyPredefinition.
 /// </summary>
 /// <param name="myPropertyName">The name of the property</param>
 public PropertyPredefinition(String myPropertyName, String myPropertyType)
     : base(myPropertyName, myPropertyType)
 {
     IsIndexed    = false;
     IsMandatory  = false;
     IsUnique     = false;
     Multiplicity = PropertyMultiplicity.Single;
 }
Ejemplo n.º 4
0
        public void StoreProperty(
            IVertexStore myStore,
            VertexInformation myVertex,
            String myName,
            String myComment,
            Int64 myCreationDate,
            bool myIsMandatory,
            PropertyMultiplicity myMultiplicity,
            String myDefaultValue,
            bool myIsUserDefined,
            VertexInformation myDefiningType,
            VertexInformation myBasicType,
            SecurityToken mySecurity,
            Int64 myTransaction)
        {
            var props = new Dictionary <long, IComparable>
            {
                { (long)AttributeDefinitions.AttributeDotName, myName },
                { (long)AttributeDefinitions.AttributeDotIsUserDefined, myIsUserDefined },
                { (long)AttributeDefinitions.PropertyDotIsMandatory, myIsMandatory },
                { (long)AttributeDefinitions.PropertyDotMultiplicity, (byte)myMultiplicity },
            };

            if (myDefaultValue != null)
            {
                props.Add((long)AttributeDefinitions.PropertyDotDefaultValue, myDefaultValue);
            }

            Store(
                myStore,
                myVertex,
                myComment,
                myCreationDate,
                new Dictionary <Tuple <long, long>, VertexInformation>
            {
                { _EdgeAttributeDotDefiningType, myDefiningType },
                { _EdgePropertyDotBaseType, myBasicType },
            },
                null,
                props,
                null,
                mySecurity,
                myTransaction);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Converts PropertyMultiplicity into serializable ServicePropertyMultiplicity, default: Single.
        /// </summary>
        /// <param name="myMultiplicity"></param>
        /// <returns></returns>
        internal static ServicePropertyMultiplicity ToServicePropertyMultiplicity(PropertyMultiplicity myMultiplicity)
        {
            ServicePropertyMultiplicity multiplicity;

            switch (myMultiplicity)
            {
            case PropertyMultiplicity.Set:
                multiplicity = ServicePropertyMultiplicity.Set;
                break;

            case PropertyMultiplicity.List:
                multiplicity = ServicePropertyMultiplicity.List;
                break;

            default:
                multiplicity = ServicePropertyMultiplicity.Single;
                break;
            }
            return(multiplicity);
        }
Ejemplo n.º 6
0
 private ICollectionWrapper CreateNewCollectionWrapper(IEnumerable<IComparable> myValues, PropertyMultiplicity myMultiplicity)
 {
     switch (myMultiplicity)
     {
         case PropertyMultiplicity.List:
             return new ListCollectionWrapper(myValues);
         case PropertyMultiplicity.Set:
             return new SetCollectionWrapper(myValues);
         case PropertyMultiplicity.Single:
             throw new Exception("This property is not a collection property");
         default:
             throw new Exception("The enumeration PropertyMultiplicity was changed, but not this switch statement.");
     }
 }
Ejemplo n.º 7
0
        public static void StoreProperty(
            IVertexStore myStore,
            VertexInformation myVertex,
            String myName,
            String myComment,
            Int64 myCreationDate,
            bool myIsMandatory,
            PropertyMultiplicity myMultiplicity,
            String myDefaultValue,
            bool myIsUserDefined,
            VertexInformation myDefiningType,
            VertexInformation myBasicType,
            SecurityToken mySecurity,
            TransactionToken myTransaction)
        {
            var props = new Dictionary<long, IComparable>
                {
                    { (long) AttributeDefinitions.AttributeDotName, myName },
                    { (long) AttributeDefinitions.AttributeDotIsUserDefined, myIsUserDefined },
                    { (long) AttributeDefinitions.PropertyDotIsMandatory, myIsMandatory },
                    { (long) AttributeDefinitions.PropertyDotMultiplicity, (byte) myMultiplicity },
                };

            if (myDefaultValue != null)
                props.Add((long) AttributeDefinitions.PropertyDotDefaultValue, myDefaultValue);

            Store(
                myStore,
                myVertex,
                myComment,
                myCreationDate,
                new Dictionary<Tuple<long, long>, VertexInformation>
                {
                    { _EdgeAttributeDotDefiningType, myDefiningType },
                    { _EdgePropertyDotBaseType, myBasicType },
                },
                null,
                props,
                null,
                mySecurity,
                myTransaction);
        }
Ejemplo n.º 8
0
        public PropertyPredefinition SetMultiplicityToSet()
        {
            Multiplicity = PropertyMultiplicity.Set;

            return this;
        }
 /// <summary>
 /// Initializes a new instance of the PropertyHasWrongTypeException class.
 /// </summary>
 /// <param name="myDefiningTypeName">The type that defines the property.</param>
 /// <param name="myPropertyName">The property that was used with the wrong type.</param>
 /// <param name="myMultiplicity"></param>
 /// <param name="myExpectedTypeName">The expected type name.</param>
 /// <param name="innerException">The exception that is the cause of the current exception, this parameter can be NULL.</param>
 public PropertyHasWrongTypeException(String myDefiningTypeName, String myPropertyName, PropertyMultiplicity myMultiplicity, String myExpectedTypeName, Exception innerException = null)
     : base(innerException)
 {
     DefiningTypeName = myDefiningTypeName;
     PropertyName     = myPropertyName;
     ExpectedTypeName = myExpectedTypeName;
     _msg             = string.Format("The property {0}.[1} needs a {3} of type {2} but was no {3}", myDefiningTypeName, myPropertyName, myExpectedTypeName, myMultiplicity.ToString());
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Converts PropertyMultiplicity into serializable ServicePropertyMultiplicity, default: Single.
 /// </summary>
 /// <param name="myMultiplicity"></param>
 /// <returns></returns>
 internal static ServicePropertyMultiplicity ToServicePropertyMultiplicity(PropertyMultiplicity myMultiplicity)
 {
     ServicePropertyMultiplicity multiplicity;
     switch (myMultiplicity)
     {
         case PropertyMultiplicity.Set:
             multiplicity = ServicePropertyMultiplicity.Set;
             break;
         case PropertyMultiplicity.List:
             multiplicity = ServicePropertyMultiplicity.List;
             break;
         default:
             multiplicity = ServicePropertyMultiplicity.Single;
             break;
     }
     return multiplicity;
 }
Ejemplo n.º 11
0
        public PropertyPredefinition SetMultiplicityToSet()
        {
            Multiplicity = PropertyMultiplicity.Set;

            return(this);
        }