예제 #1
0
            /// <summary>
            /// Resolves the specified data type.
            /// </summary>
            /// <param name="dataType">Data type specification.</param>
            /// <returns>Resolved EDM Type.</returns>
            PrimitiveDataType IPrimitiveDataTypeVisitor <PrimitiveDataType> .Visit(FixedPointDataType dataType)
            {
                int?precision = null;
                int?scale     = null;

                NumericPrecisionFacet precisionFacet;
                NumericScaleFacet     scaleFacet;

                if (dataType.TryGetFacet(out precisionFacet))
                {
                    precision = precisionFacet.Value;
                }

                if (dataType.TryGetFacet(out scaleFacet))
                {
                    scale = scaleFacet.Value;
                }

                return(EdmDataTypes.Decimal(precision, scale));
            }
예제 #2
0
 /// <summary>
 /// Initializes static members of the DataTypes class.
 /// </summary>
 static DataTypes()
 {
     Integer = new IntegerDataType();
     Stream = new StreamDataType();
     String = new StringDataType();
     Boolean = new BooleanDataType();
     FixedPoint = new FixedPointDataType();
     FloatingPoint = new FloatingPointDataType();
     DateTime = new DateTimeDataType();
     Binary = new BinaryDataType();
     Guid = new GuidDataType();
     TimeOfDay = new TimeOfDayDataType();
     ComplexType = new ComplexDataType();
     EntityType = new EntityDataType();
     CollectionType = new CollectionDataType();
     ReferenceType = new ReferenceDataType();
     RowType = new RowDataType();
     EnumType = new EnumDataType();
     Spatial = new SpatialDataType();
 }
        IEdmPrimitiveTypeReference IPrimitiveDataTypeVisitor <IEdmPrimitiveTypeReference> .Visit(FixedPointDataType dataType)
        {
            IEdmPrimitiveType typeDefinition = this.GetEdmTypeDefinition(dataType);

            int?precision = null, scale = null;

            if (dataType.HasFacet <NumericPrecisionFacet>())
            {
                precision = dataType.GetFacet <NumericPrecisionFacet>().Value;
            }

            if (dataType.HasFacet <NumericScaleFacet>())
            {
                scale = dataType.GetFacet <NumericScaleFacet>().Value;
            }

            var typeReference = new EdmDecimalTypeReference(
                typeDefinition,
                dataType.IsNullable,
                precision,
                scale);

            return(typeReference);
        }