Beispiel #1
0
        public override IOrmAttribute MergeChanges(IOrmAttribute otherAttribute, MergeConflictAction mergeConflictAction)
        {
            OrmFieldAttribute other        = (OrmFieldAttribute)otherAttribute;
            OrmFieldAttribute mergedResult = new OrmFieldAttribute();


            Defaultable <ObjectValue> defaultValue =
                this.GetDefaultValueAsDefaultable().Merge(other.GetDefaultValueAsDefaultable(),
                                                          mergeConflictAction);

            mergedResult.DefaultValue         = new ObjectValueInfo();
            mergedResult.DefaultValue.Enabled = defaultValue.IsCustom();
            mergedResult.DefaultValue.Value   = defaultValue.Value;

            mergedResult.Indexed           = this.Indexed.Merge(other.Indexed, mergeConflictAction);
            mergedResult.Nullable          = this.Nullable.Merge(other.Nullable, mergeConflictAction);
            mergedResult.Precision         = this.Precision.Merge(other.Precision, mergeConflictAction);
            mergedResult.Scale             = this.Scale.Merge(other.Scale, mergeConflictAction);
            mergedResult.LazyLoad          = this.LazyLoad.Merge(other.LazyLoad, mergeConflictAction);
            mergedResult.Length            = this.Length.Merge(other.Length, mergeConflictAction);
            mergedResult.NullableOnUpgrade = this.NullableOnUpgrade.Merge(other.NullableOnUpgrade, mergeConflictAction);
            mergedResult.MappingName       = this.MappingName.Merge(other.MappingName, mergeConflictAction);
            mergedResult.Version           = this.Version.Merge(other.Version, mergeConflictAction);
            mergedResult.TypeDiscriminator = this.TypeDiscriminator.Merge(other.TypeDiscriminator, mergeConflictAction);

            //mergedResult.Constraints = this.Constraints.Merge(other.Constraints, mergeConflictAction);

            return(mergedResult);
        }
Beispiel #2
0
        public bool EqualsTo(OrmFieldAttribute other)
        {
            List <Defaultable> currentDefaultableItems = GetAttributeGroupItems(AttributeGroupsListMode.All);
            List <Defaultable> otherDefaultableItems   = other.GetAttributeGroupItems(AttributeGroupsListMode.All);

            for (int i = 0; i < currentDefaultableItems.Count; i++)
            {
                Defaultable currentItem = currentDefaultableItems[i];
                Defaultable otherItem   = otherDefaultableItems[i];
                if (!currentItem.EqualsTo(otherItem))
                {
                    return(false);
                }
            }

            return(true);
        }
Beispiel #3
0
        public override object CreateInstance(ITypeDescriptorContext context, IDictionary propertyValues)
        {
            OrmFieldAttribute result = new OrmFieldAttribute
            {
                MappingName       = (Defaultable <string>)propertyValues["MappingName"],
                DefaultValue      = (ObjectValueInfo)propertyValues["DefaultValue"],
                Indexed           = (Defaultable <bool>)propertyValues["Indexed"],
                LazyLoad          = (Defaultable <bool>)propertyValues["LazyLoad"],
                Length            = (Defaultable <int>)propertyValues["Length"],
                Nullable          = (Defaultable <bool>)propertyValues["Nullable"],
                NullableOnUpgrade = (Defaultable <bool>)propertyValues["NullableOnUpgrade"],
                Precision         = (Defaultable <int>)propertyValues["Precision"],
                Scale             = (Defaultable <int>)propertyValues["Scale"],
                TypeDiscriminator = (Defaultable <bool>)propertyValues["TypeDiscriminator"],
                Version           = (Defaultable <VersionMode>)propertyValues["Version"]
                                    //Constraints = (PropertyConstraints)propertyValues["Constraints"]
            };

            return(result);
        }