private MethodInfo GetValueReaderProxy(IBindingColumnInfo columnInfo, IBindingValueContract fallback)
        {
            if (columnInfo.Column.Type == typeof(TimeSpan))
            {
                return(this.GetMySqlReaderMethod(nameof(MySqlDataReader.GetTimeSpan)));
            }
            else if (columnInfo.Column.Type == typeof(sbyte))
            {
                return(this.GetMySqlReaderMethod(nameof(MySqlDataReader.GetSByte)));
            }
            else if (columnInfo.Column.Type == typeof(ushort))
            {
                return(this.GetMySqlReaderMethod(nameof(MySqlDataReader.GetUInt16)));
            }
            else if (columnInfo.Column.Type == typeof(uint))
            {
                return(this.GetMySqlReaderMethod(nameof(MySqlDataReader.GetUInt32)));
            }
            else if (columnInfo.Column.Type == typeof(ulong))
            {
                return(this.GetMySqlReaderMethod(nameof(MySqlDataReader.GetUInt64)));
            }

            return(fallback?.Read(columnInfo));
        }
示例#2
0
        private MethodInfo GetValueReaderProxy(IBindingColumnInfo columnInfo, IBindingValueContract fallback)
        {
            if (columnInfo.Column.Type == typeof(TimeSpan))
            {
                return(this.GetNpgsqlReaderMethod(nameof(NpgsqlDataReader.GetTimeSpan)));
            }

            return(fallback?.Read(columnInfo));
        }
        private MethodInfo GetColumnReaderProxy(IBindingColumnInfo columnInfo)
        {
            if (columnInfo.Column.Type == typeof(string))
            {
                return(typeof(IDataRecord).GetMethod(nameof(IDataReader.GetString), new[] { typeof(int) }));
            }

            return(null);
        }
        private MethodInfo GetValueReaderProxy(IBindingColumnInfo columnInfo, IBindingValueContract fallback)
        {
            if (columnInfo.Column.Type == typeof(TimeSpan))
            {
                return(this.GetOracleReaderMethod(nameof(OracleDataReader.GetTimeSpan)));
            }
            else if (columnInfo.Column.Type == typeof(DateTimeOffset) || columnInfo.Column.TypeName == "TimeStampTZ")
            {
                return(this.GetOracleReaderMethod(nameof(OracleDataReader.GetDateTimeOffset)));
            }

            return(fallback?.Read(columnInfo));
        }
        private MethodInfo GetValueReadMethod(IBindingColumnInfo columnInfo, IBindingValueContract fallback)
        {
            if (columnInfo.Column.Type == typeof(DateTimeOffset))
            {
                return(this.GetSqlReaderMethod("GetDateTimeOffset"));
            }
            else if (columnInfo.Column.Type == typeof(TimeSpan))
            {
                return(this.GetSqlReaderMethod("GetTimeSpan"));
            }

            return(fallback?.Read(columnInfo));
        }
        private MethodInfo GetRecordReaderMethod(IBindingColumnInfo columnInfo, IBindingValueContract fallback)
        {
            switch (columnInfo.Column.TypeName?.ToLower())
            {
            case "integer" when columnInfo.Column.Type == typeof(long):
                return(this.GetRecordMethod(nameof(IDataReader.GetInt64)));

            case "int":
            case "integer":
            case "mediumint":
                return(this.GetRecordMethod(nameof(IDataReader.GetInt32)));

            case "tinyint":
                return(this.GetRecordMethod(nameof(IDataReader.GetByte)));

            case "smallint":
                return(this.GetRecordMethod(nameof(IDataReader.GetInt16)));

            case "unsigned big int":
            case "bigint":
                return(this.GetRecordMethod(nameof(IDataReader.GetInt64)));

            case "nvarchar":
            case "varchar":
            case "varying character":
            case "nchar":
            case "native character":
            case "text":
            case "clob":
                return(this.GetRecordMethod(nameof(IDataReader.GetString)));

            case "float":
                return(this.GetRecordMethod(nameof(IDataReader.GetFloat)));

            case "decimal":
            case "double precision":
                return(this.GetRecordMethod(nameof(IDataReader.GetDouble)));

            case "datetime":
            case "date":
                return(this.GetRecordMethod(nameof(IDataReader.GetDateTime)));

            case "boolean":
                return(this.GetRecordMethod(nameof(IDataReader.GetBoolean)));

            case "blob":
                return(this.GetBlobReaderMethod(columnInfo.Metadata));
            }

            return(fallback?.Read(columnInfo));
        }