public static DbPrimitiveTypeFacets Clone(this DbPrimitiveTypeFacets toClone)
        {
            Contract.Requires(toClone != null);

            var clone = new DbPrimitiveTypeFacets();

            clone.CopyFrom(toClone);

            return clone;
        }
        internal override void Configure(DbPrimitiveTypeFacets facets, FacetDescription facetDescription)
        {
            base.Configure(facets, facetDescription);

            switch (facetDescription.FacetName)
            {
                case SsdlConstants.Attribute_Precision:
                    facets.Precision = facetDescription.IsConstant ? null : Precision ?? facets.Precision;
                    break;
            }
        }
        internal override void Configure(DbPrimitiveTypeFacets facets, FacetDescription facetDescription)
        {
            base.Configure(facets, facetDescription);

            switch (facetDescription.FacetName)
            {
                case SsdlConstants.Attribute_Unicode:
                    facets.IsUnicode = facetDescription.IsConstant ? null : IsUnicode ?? facets.IsUnicode;
                    break;
            }
        }
 internal override void Configure(DbPrimitiveTypeFacets facets, FacetDescription facetDescription)
 {
     switch (facetDescription.FacetName)
     {
         case SsdlConstants.Attribute_FixedLength:
             facets.IsFixedLength = facetDescription.IsConstant ? null : IsFixedLength ?? facets.IsFixedLength;
             break;
         case SsdlConstants.Attribute_MaxLength:
             facets.MaxLength = facetDescription.IsConstant ? null : MaxLength ?? facets.MaxLength;
             facets.IsMaxLength = facetDescription.IsConstant ? null : IsMaxLength ?? facets.IsMaxLength;
             break;
     }
 }
        public static void CopyFrom(this DbPrimitiveTypeFacets facets, DbPrimitiveTypeFacets other)
        {
            Contract.Requires(facets != null);
            Contract.Requires(other != null);

            facets.IsFixedLength = other.IsFixedLength;
            facets.IsMaxLength = other.IsMaxLength;
            facets.IsUnicode = other.IsUnicode;
            facets.MaxLength = other.MaxLength;
            facets.Precision = other.Precision;
            facets.Scale = other.Scale;
            facets.IsVariableSrid = other.IsVariableSrid;
            facets.Srid = other.Srid;
            facets.IsStrict = other.IsStrict;
        }
 protected void VisitDbPrimitiveTypeFacets(DbPrimitiveTypeFacets item)
 {
     VisitDbDataModelItem(item);
 }
        internal static void MapPrimitivePropertyFacets(
            EdmPrimitiveTypeFacets primitiveTypeFacets, DbPrimitiveTypeFacets dbPrimitiveTypeFacets, TypeUsage typeUsage)
        {
            Contract.Requires(primitiveTypeFacets != null);
            Contract.Requires(dbPrimitiveTypeFacets != null);
            Contract.Requires(typeUsage != null);

            if (IsValidFacet(typeUsage, SsdlConstants.Attribute_FixedLength))
            {
                dbPrimitiveTypeFacets.IsFixedLength = primitiveTypeFacets.IsFixedLength;
            }

            if (IsValidFacet(typeUsage, SsdlConstants.Attribute_MaxLength))
            {
                dbPrimitiveTypeFacets.IsMaxLength = primitiveTypeFacets.IsMaxLength;
                dbPrimitiveTypeFacets.MaxLength = primitiveTypeFacets.MaxLength;
            }

            if (IsValidFacet(typeUsage, SsdlConstants.Attribute_Unicode))
            {
                dbPrimitiveTypeFacets.IsUnicode = primitiveTypeFacets.IsUnicode;
            }

            if (IsValidFacet(typeUsage, SsdlConstants.Attribute_Precision))
            {
                dbPrimitiveTypeFacets.Precision = primitiveTypeFacets.Precision;
            }

            if (IsValidFacet(typeUsage, SsdlConstants.Attribute_Scale))
            {
                dbPrimitiveTypeFacets.Scale = primitiveTypeFacets.Scale;
            }

            if (IsValidFacet(typeUsage, SsdlConstants.Attribute_Srid))
            {
                dbPrimitiveTypeFacets.IsVariableSrid = primitiveTypeFacets.IsVariableSrid;
                dbPrimitiveTypeFacets.Srid = primitiveTypeFacets.Srid;
            }

            if (IsValidFacet(typeUsage, SsdlConstants.Attribute_IsStrict))
            {
                dbPrimitiveTypeFacets.IsStrict = primitiveTypeFacets.IsStrict;
            }
        }
 private IEnumerable<KeyValuePair<string, string>> GetEnumerableFacetValueFromPrimitiveTypeFacets(
     DbPrimitiveTypeFacets facets)
 {
     if (facets != null)
     {
         if (facets.IsFixedLength.HasValue)
         {
             yield return
                 new KeyValuePair<string, string>(
                     SsdlConstants.Attribute_FixedLength,
                     GetLowerCaseStringFromBoolValue(facets.IsFixedLength.Value));
         }
         if (facets.IsMaxLength.HasValue)
         {
             yield return
                 new KeyValuePair<string, string>(SsdlConstants.Attribute_MaxLength, SsdlConstants.Value_Max);
         }
         if (facets.IsUnicode.HasValue)
         {
             yield return
                 new KeyValuePair<string, string>(
                     SsdlConstants.Attribute_Unicode, GetLowerCaseStringFromBoolValue(facets.IsUnicode.Value));
         }
         if (facets.MaxLength.HasValue)
         {
             yield return
                 new KeyValuePair<string, string>(
                     SsdlConstants.Attribute_MaxLength,
                     facets.MaxLength.Value.ToString(CultureInfo.InvariantCulture));
         }
         if (facets.Precision.HasValue)
         {
             yield return
                 new KeyValuePair<string, string>(
                     SsdlConstants.Attribute_Precision,
                     facets.Precision.Value.ToString(CultureInfo.InvariantCulture));
         }
         if (facets.Scale.HasValue)
         {
             yield return
                 new KeyValuePair<string, string>(
                     SsdlConstants.Attribute_Scale, facets.Scale.Value.ToString(CultureInfo.InvariantCulture));
         }
         yield break;
     }
 }