Exemplo n.º 1
0
        /// <summary>
        /// Check for default values.
        /// If a default value is set for the property, than we add this to the insert definition.
        /// </summary>
        /// <param name="myPropertyProvider">The insert definition.</param>
        /// <param name="myBaseType">The vertex type, which is to be updated.</param>
        private static void ConvertDefaultValues(IPropertyProvider myPropertyProvider, IBaseType myBaseType)
        {
            if (myPropertyProvider.StructuredProperties != null)
            {
                var checkForDefaultValues = myBaseType.GetPropertyDefinitions(true).Where(item => !myPropertyProvider.StructuredProperties.ContainsKey(item.Name)).Where(_ => _.DefaultValue != null);

                foreach (var item in checkForDefaultValues)
                {
                    myPropertyProvider.AddStructuredProperty(item.Name, item.DefaultValue);
                }
            }
        }
Exemplo n.º 2
0
        protected void CheckMandatoryConstraint(IPropertyProvider myPropertyProvider, IBaseType myType)
        {
            var mandatories = myType.GetPropertyDefinitions(true).Where(IsMustSetProperty).ToArray();

            foreach (var mand in mandatories)
            {
                if (myPropertyProvider == null || myPropertyProvider.StructuredProperties == null ||
                    !myPropertyProvider.StructuredProperties.Any(x => mand.Name.Equals(x.Key)))
                {
                    throw new MandatoryConstraintViolationException(mand.Name);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Check for default values.
        /// If a default value is set for the property, than we add this to the insert definition.
        /// </summary>
        /// <param name="myPropertyProvider">The insert definition.</param>
        /// <param name="myBaseType">The vertex type, which is to be updated.</param>
        private static void ConvertDefaultValues(IPropertyProvider myPropertyProvider, IBaseType myBaseType)
        {
            if (myPropertyProvider.StructuredProperties != null)
            {
                var checkForDefaultValues = myBaseType.GetPropertyDefinitions(true).Where(item => !myPropertyProvider.StructuredProperties.ContainsKey(item.Name)).Where(_ => _.DefaultValue != null);

                foreach (var item in checkForDefaultValues)
                {
                    myPropertyProvider.AddStructuredProperty(item.Name, item.DefaultValue);
                }
            }
        }
Exemplo n.º 4
0
        protected void CheckMandatoryConstraint(IPropertyProvider myPropertyProvider, IBaseType myType)
        {
            var mandatories = myType.GetPropertyDefinitions(true).Where(IsMustSetProperty).ToArray();

            foreach (var mand in mandatories)
            {
                if (myPropertyProvider == null || myPropertyProvider.StructuredProperties == null ||
                    !myPropertyProvider.StructuredProperties.Any(x => mand.Name.Equals(x.Key)))
                {
                    throw new MandatoryConstraintViolationException(mand.Name);
                }
            }
        }