コード例 #1
0
            private static PrimitiveDataType FixupType(PrimitiveDataType primitiveDataType, Type clrType)
            {
                // Add precision and scale for decimal properties.
                if (clrType == typeof(decimal))
                {
                    if (!primitiveDataType.Facets.Any(f => f is NumericPrecisionFacet))
                    {
                        primitiveDataType = primitiveDataType.WithFacet(new NumericPrecisionFacet(28));
                    }

                    if (!primitiveDataType.Facets.Any(f => f is NumericScaleFacet))
                    {
                        int precision = primitiveDataType.GetFacet <NumericPrecisionFacet>().Value;
                        primitiveDataType = primitiveDataType.WithFacet(new NumericScaleFacet(Math.Min(4, precision)));
                    }
                }

                return(primitiveDataType);
            }
コード例 #2
0
            private static PrimitiveDataType FixupType(PrimitiveDataType primitiveDataType, Type clrType)
            {
                // Add precision and scale for decimal properties.
                if (clrType == typeof(decimal))
                {
                    if (!primitiveDataType.Facets.Any(f => f is NumericPrecisionFacet))
                    {
                        primitiveDataType = primitiveDataType.WithFacet(new NumericPrecisionFacet(28));
                    }

                    if (!primitiveDataType.Facets.Any(f => f is NumericScaleFacet))
                    {
                        int precision = primitiveDataType.GetFacet<NumericPrecisionFacet>().Value;
                        primitiveDataType = primitiveDataType.WithFacet(new NumericScaleFacet(Math.Min(4, precision)));
                    }
                }

                return primitiveDataType;
            }