Exemple #1
0
        private bool AnnotationsAreCompatible(
            PrimitivePropertyConfiguration other,
            ref string errorMessage)
        {
            bool flag = true;

            foreach (KeyValuePair <string, object> annotation1 in (IEnumerable <KeyValuePair <string, object> >) this.Annotations)
            {
                if (other.Annotations.ContainsKey(annotation1.Key))
                {
                    object objA        = annotation1.Value;
                    object annotation2 = other.Annotations[annotation1.Key];
                    IMergeableAnnotation mergeableAnnotation = objA as IMergeableAnnotation;
                    if (mergeableAnnotation != null)
                    {
                        CompatibilityResult compatibilityResult = mergeableAnnotation.IsCompatibleWith(annotation2);
                        if (!(bool)compatibilityResult)
                        {
                            flag = false;
                            ref string local = ref errorMessage;
                            local = local + Environment.NewLine + "\t" + compatibilityResult.ErrorMessage;
                        }
                    }
                    else if (!object.Equals(objA, annotation2))
                    {
                        flag = false;
                        ref string local = ref errorMessage;
                        local = local + Environment.NewLine + "\t" + Strings.ConflictingAnnotationValue((object)annotation1.Key, (object)objA.ToString(), (object)annotation2.ToString());
                    }
                }
Exemple #2
0
 internal virtual void MakeCompatibleWith(PrimitivePropertyConfiguration other, bool inCSpace)
 {
     if (object.ReferenceEquals((object)this, (object)other))
     {
         return;
     }
     if (inCSpace)
     {
         if (other.ConcurrencyMode.HasValue)
         {
             this.ConcurrencyMode = new System.Data.Entity.Core.Metadata.Edm.ConcurrencyMode?();
         }
         if (other.DatabaseGeneratedOption.HasValue)
         {
             this.DatabaseGeneratedOption = new System.ComponentModel.DataAnnotations.Schema.DatabaseGeneratedOption?();
         }
         if (!other.IsNullable.HasValue)
         {
             return;
         }
         this.IsNullable = new bool?();
     }
     else
     {
         if (other.ColumnName != null)
         {
             this.ColumnName = (string)null;
         }
         if (other.ParameterName != null)
         {
             this.ParameterName = (string)null;
         }
         if (other.ColumnOrder.HasValue)
         {
             this.ColumnOrder = new int?();
         }
         if (other.ColumnType != null)
         {
             this.ColumnType = (string)null;
         }
         foreach (string key in (IEnumerable <string>)other._annotations.Keys)
         {
             if (this._annotations.ContainsKey(key))
             {
                 IMergeableAnnotation annotation = this._annotations[key] as IMergeableAnnotation;
                 if (annotation == null || !(bool)annotation.IsCompatibleWith(other._annotations[key]))
                 {
                     this._annotations.Remove(key);
                 }
             }
         }
     }
 }
Exemple #3
0
 internal virtual void FillFrom(PrimitivePropertyConfiguration other, bool inCSpace)
 {
     if (object.ReferenceEquals((object)this, (object)other))
     {
         return;
     }
     if (inCSpace)
     {
         if (!this.ConcurrencyMode.HasValue)
         {
             this.ConcurrencyMode = other.ConcurrencyMode;
         }
         if (!this.DatabaseGeneratedOption.HasValue)
         {
             this.DatabaseGeneratedOption = other.DatabaseGeneratedOption;
         }
         if (!this.IsNullable.HasValue)
         {
             this.IsNullable = other.IsNullable;
         }
         if (other.OverridableConfigurationParts.HasFlag((Enum)OverridableConfigurationParts.OverridableInCSpace))
         {
             return;
         }
         this.OverridableConfigurationParts &= ~OverridableConfigurationParts.OverridableInCSpace;
     }
     else
     {
         if (this.ColumnName == null)
         {
             this.ColumnName = other.ColumnName;
         }
         if (this.ParameterName == null)
         {
             this.ParameterName = other.ParameterName;
         }
         if (!this.ColumnOrder.HasValue)
         {
             this.ColumnOrder = other.ColumnOrder;
         }
         if (this.ColumnType == null)
         {
             this.ColumnType = other.ColumnType;
         }
         foreach (KeyValuePair <string, object> annotation1 in (IEnumerable <KeyValuePair <string, object> >)other._annotations)
         {
             if (this._annotations.ContainsKey(annotation1.Key))
             {
                 IMergeableAnnotation annotation2 = this._annotations[annotation1.Key] as IMergeableAnnotation;
                 if (annotation2 != null)
                 {
                     this._annotations[annotation1.Key] = annotation2.MergeWith(annotation1.Value);
                 }
             }
             else
             {
                 this._annotations[annotation1.Key] = annotation1.Value;
             }
         }
         if (other.OverridableConfigurationParts.HasFlag((Enum)OverridableConfigurationParts.OverridableInSSpace))
         {
             return;
         }
         this.OverridableConfigurationParts &= ~OverridableConfigurationParts.OverridableInSSpace;
     }
 }