예제 #1
0
 protected virtual void VisitEdmPrimitiveTypeFacets(EdmPrimitiveTypeFacets facets)
 {
     VisitEdmDataModelItem(facets);
 }
        internal static IEnumerable<KeyValuePair<string, string>> GetEnumerableFacetValueFromPrimitiveTypeFacets(
            EdmPrimitiveTypeFacets facets)
        {
            if (facets != null)
            {
                if (facets.IsFixedLength.HasValue)
                {
                    yield return
                        new KeyValuePair<string, string>(
                            CsdlConstants.Attribute_FixedLength,
                            GetLowerCaseStringFromBoolValue(facets.IsFixedLength.Value));
                }
                if (facets.IsMaxLength.HasValue
                    && facets.IsMaxLength.Value)
                {
                    yield return
                        new KeyValuePair<string, string>(CsdlConstants.Attribute_MaxLength, CsdlConstants.Value_Max);
                }
                else if (facets.MaxLength.HasValue)
                {
                    yield return
                        new KeyValuePair<string, string>(
                            CsdlConstants.Attribute_MaxLength,
                            facets.MaxLength.Value.ToString(CultureInfo.InvariantCulture));
                }
                if (facets.IsUnicode.HasValue)
                {
                    yield return
                        new KeyValuePair<string, string>(
                            CsdlConstants.Attribute_Unicode, GetLowerCaseStringFromBoolValue(facets.IsUnicode.Value));
                }

                if (facets.Precision.HasValue)
                {
                    yield return
                        new KeyValuePair<string, string>(
                            CsdlConstants.Attribute_Precision,
                            facets.Precision.Value.ToString(CultureInfo.InvariantCulture));
                }
                if (facets.Scale.HasValue)
                {
                    yield return
                        new KeyValuePair<string, string>(
                            CsdlConstants.Attribute_Scale, facets.Scale.Value.ToString(CultureInfo.InvariantCulture));
                }
            }
        }