コード例 #1
0
        public static DbPrimitiveTypeFacets Clone(this DbPrimitiveTypeFacets toClone)
        {
            Contract.Requires(toClone != null);

            var clone = new DbPrimitiveTypeFacets();

            clone.CopyFrom(toClone);

            return clone;
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
 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;
     }
 }
コード例 #5
0
        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;
        }
コード例 #6
0
 protected void VisitDbPrimitiveTypeFacets(DbPrimitiveTypeFacets item)
 {
     VisitDbDataModelItem(item);
 }
コード例 #7
0
        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;
            }
        }
コード例 #8
0
 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;
     }
 }