Ejemplo n.º 1
0
 public MySqlStringTypeMapping(
     [NotNull] string storeType,
     IMySqlOptions options,
     StoreTypePostfix storeTypePostfix,
     bool unicode       = true,
     int?size           = null,
     bool fixedLength   = false,
     bool unquoted      = false,
     bool forceToString = false)
     : this(
         new RelationalTypeMappingParameters(
             new CoreTypeMappingParameters(typeof(string)),
             storeType,
             storeTypePostfix,
             unicode
                 ? fixedLength
                     ? System.Data.DbType.StringFixedLength
                     : System.Data.DbType.String
                 : fixedLength
                     ? System.Data.DbType.AnsiStringFixedLength
                     : System.Data.DbType.AnsiString,
             unicode,
             size,
             fixedLength),
         fixedLength
             ? MySqlDbType.String
             : MySqlDbType.VarString,
         options,
         unquoted,
         forceToString)
 {
 }
Ejemplo n.º 2
0
            /// <summary>
            ///     Creates a new <see cref="RelationalTypeMappingParameters" /> parameter object.
            /// </summary>
            /// <param name="coreParameters"> Parameters for the <see cref="CoreTypeMapping" /> base class. </param>
            /// <param name="storeType"> The name of the database type. </param>
            /// <param name="storeTypePostfix"> Indicates which values should be appended to the store type name. </param>
            /// <param name="dbType"> The <see cref="System.Data.DbType" /> to be used. </param>
            /// <param name="unicode"> A value indicating whether the type should handle Unicode data or not. </param>
            /// <param name="size"> The size of data the property is configured to store, or null if no size is configured. </param>
            /// <param name="fixedLength"> A value indicating whether the type is constrained to fixed-length data. </param>
            /// <param name="precision"> The precision of data the property is configured to store, or null if no size is configured. </param>
            /// <param name="scale"> The scale of data the property is configured to store, or null if no size is configured. </param>
            public RelationalTypeMappingParameters(
                CoreTypeMappingParameters coreParameters,
                [NotNull] string storeType,
                StoreTypePostfix storeTypePostfix = StoreTypePostfix.None,
                DbType?dbType    = null,
                bool unicode     = false,
                int?size         = null,
                bool fixedLength = false,
                int?precision    = null,
                int?scale        = null)
            {
                Check.NotEmpty(storeType, nameof(storeType));

                var converterHints = coreParameters.Converter?.MappingHints;

                CoreParameters   = coreParameters;
                StoreType        = storeType;
                StoreTypePostfix = storeTypePostfix;
                DbType           = dbType;
                Unicode          = unicode;
                Size             = size ?? converterHints?.Size;
                Precision        = precision ?? converterHints?.Precision;
                Scale            = scale ?? converterHints?.Scale;
                FixedLength      = fixedLength;
            }
Ejemplo n.º 3
0
        /// <summary>
        ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
        ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
        ///     any release. You should only use it directly in your code with extreme caution and knowing that
        ///     doing so can result in application failures when updating to a new Entity Framework Core release.
        /// </summary>
        public SqlServerUdtTypeMapping(
            Type clrType,
            string storeType,
            Func <object, Expression> literalGenerator,
            StoreTypePostfix storeTypePostfix = StoreTypePostfix.None,
            string?udtTypeName        = null,
            ValueConverter?converter  = null,
            ValueComparer?comparer    = null,
            ValueComparer?keyComparer = null,
            DbType?dbType             = null,
            bool unicode     = false,
            int?size         = null,
            bool fixedLength = false,
            int?precision    = null,
            int?scale        = null)
            : base(
                new RelationalTypeMappingParameters(
                    new CoreTypeMappingParameters(
                        clrType, converter, comparer, keyComparer), storeType, storeTypePostfix, dbType, unicode, size, fixedLength,
                    precision, scale))

        {
            LiteralGenerator = literalGenerator;
            UdtTypeName      = udtTypeName ?? storeType;
        }
 /// <summary>
 /// 实例化
 /// </summary>
 /// <param name="storeType">存储类型</param>
 /// <param name="dbType">数据库类型</param>
 /// <param name="precision">精度</param>
 /// <param name="scale">范围</param>
 /// <param name="storeTypePostfix">存储类型后缀</param>
 public OracleRealTypeMapping(
     [NotNull] string storeType,
     DbType?dbType = null,
     int?precision = null,
     int?scale     = null,
     StoreTypePostfix storeTypePostfix = StoreTypePostfix.None)
     : base(new RelationalTypeMappingParameters(new CoreTypeMappingParameters(typeof(double)), storeType, storeTypePostfix, dbType, unicode: false, null, fixedLength: false, precision, scale))
 {
     //
 }
Ejemplo n.º 5
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public SqlServerDateTimeTypeMapping(
     string storeType,
     DbType?dbType = System.Data.DbType.DateTime2,
     StoreTypePostfix storeTypePostfix = StoreTypePostfix.Precision)
     : base(
         new RelationalTypeMappingParameters(
             new CoreTypeMappingParameters(typeof(DateTime)),
             storeType,
             storeTypePostfix,
             dbType))
 {
 }
Ejemplo n.º 6
0
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public SqlServerDoubleTypeMapping(
     string storeType,
     DbType?dbType = null,
     StoreTypePostfix storeTypePostfix = StoreTypePostfix.Precision)
     : base(
         new RelationalTypeMappingParameters(
             new CoreTypeMappingParameters(typeof(double)),
             storeType,
             storeTypePostfix,
             dbType))
 {
 }
Ejemplo n.º 7
0
 /// <summary>
 ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
 ///     directly from your code. This API may change or be removed in future releases.
 /// </summary>
 public MySqlDecimalTypeMapping([NotNull] string storeType,
                                DbType?dbType = null,
                                int?precision = null,
                                int?scale     = null,
                                StoreTypePostfix storeTypePostfix = StoreTypePostfix.PrecisionAndScale)
     : this(
         new RelationalTypeMappingParameters(
             new CoreTypeMappingParameters(typeof(decimal)),
             storeType,
             storeTypePostfix,
             dbType)
         .WithPrecisionAndScale(precision, scale))
 {
 }
 public VfpNumericTypeMapping(
     VfpType vfpType,
     int?precision = null,
     int?scale     = null,
     StoreTypePostfix storeTypePostfix = StoreTypePostfix.None
     ) : this(new RelationalTypeMappingParameters(
                  new CoreTypeMappingParameters(typeof(decimal)),
                  vfpType.ToVfpTypeName(),
                  storeTypePostfix,
                  vfpType.ToDbType()
                  ).WithPrecisionAndScale(precision, scale),
              vfpType
              )
 {
 }
Ejemplo n.º 9
0
 // #12405
 private RelationalTypeMappingParameters(
     CoreTypeMappingParameters coreParameters,
     [NotNull] string storeType,
     StoreTypePostfix storeTypePostfix = StoreTypePostfix.None,
     DbType?dbType    = null,
     bool unicode     = false,
     int?size         = null,
     bool fixedLength = false,
     int?precision    = null,
     int?scale        = null,
     bool precisionAndScaleOverriden = false)
     : this(coreParameters, storeType, storeTypePostfix, dbType, unicode, size, fixedLength, precision, scale)
 {
     PrecisionAndScaleOverriden = precisionAndScaleOverriden;
 }
 /// <summary>
 ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
 ///     directly from your code. This API may change or be removed in future releases.
 /// </summary>
 public AseDecimalTypeMapping(
     string storeType,
     DbType?dbType = null,
     int?precision = null,
     int?scale     = null,
     StoreTypePostfix storeTypePostfix = StoreTypePostfix.None)
     : base(
         new RelationalTypeMappingParameters(
             new CoreTypeMappingParameters(typeof(decimal)),
             storeType,
             storeTypePostfix,
             dbType)
         .WithPrecisionAndScale(precision, scale))
 {
 }
 /// <summary>
 ///     This is an internal API that supports the Entity Framework Core infrastructure and not subject to
 ///     the same compatibility standards as public APIs. It may be changed or removed without notice in
 ///     any release. You should only use it directly in your code with extreme caution and knowing that
 ///     doing so can result in application failures when updating to a new Entity Framework Core release.
 /// </summary>
 public SqlServerDecimalTypeMapping(
     string storeType,
     DbType?dbType = System.Data.DbType.Decimal,
     int?precision = null,
     int?scale     = null,
     StoreTypePostfix storeTypePostfix = StoreTypePostfix.PrecisionAndScale)
     : base(
         new RelationalTypeMappingParameters(
             new CoreTypeMappingParameters(typeof(decimal)),
             storeType,
             storeTypePostfix,
             dbType)
         .WithPrecisionAndScale(precision, scale))
 {
 }
Ejemplo n.º 12
0
 public OracleDecimalTypeMapping(
     [NotNull] string storeType,
     DbType?dbType = null,
     int?precision = null,
     int?scale     = null,
     StoreTypePostfix storeTypePostfix = StoreTypePostfix.None)
     : base(
         new RelationalTypeMappingParameters(
             new CoreTypeMappingParameters(typeof(decimal)),
             storeType,
             storeTypePostfix,
             dbType,
             precision: precision,
             scale: scale))
 {
 }
Ejemplo n.º 13
0
 public static object CreateParameters(
     Type type,
     int?size         = null,
     bool unicode     = false,
     bool fixedLength = false,
     StoreTypePostfix storeTypePostfix = StoreTypePostfix.PrecisionAndScale)
 => new RelationalTypeMappingParameters(
     new CoreTypeMappingParameters(
         type,
         new FakeValueConverter(),
         new FakeValueComparer(),
         new FakeValueComparer()),
     "<original>",
     storeTypePostfix,
     System.Data.DbType.VarNumeric,
     size: size,
     unicode: unicode,
     fixedLength: fixedLength);
Ejemplo n.º 14
0
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public MySqlUdtTypeMapping(
            [NotNull] Type clrType,
            [NotNull] string storeType,
            StoreTypePostfix storeTypePostfix     = StoreTypePostfix.None,
            [CanBeNull] string udtTypeName        = null,
            [CanBeNull] ValueConverter converter  = null,
            [CanBeNull] ValueComparer comparer    = null,
            [CanBeNull] ValueComparer keyComparer = null,
            DbType?dbType    = null,
            bool unicode     = false,
            int?size         = null,
            bool fixedLength = false,
            int?precision    = null,
            int?scale        = null)
            : base(new RelationalTypeMappingParameters(
                       new CoreTypeMappingParameters(
                           clrType, converter, comparer, keyComparer), storeType, storeTypePostfix, dbType, unicode, size, fixedLength, precision, scale))

        {
            UdtTypeName = udtTypeName ?? storeType;
        }