File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
src/EFCore.Ydb/test/EntityFrameworkCore.Ydb.FunctionalTests/Query Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,37 @@ public void Type_mapping_custom_decimal_is_30_10()
8080 Assert . Equal ( "Decimal(30, 10)" , mapping . StoreType ) ;
8181 }
8282
83+ [ ConditionalFact ]
84+ public async Task Parameter_decimal_respects_custom_30_10_and_roundtrips_if_supported ( )
85+ {
86+ var cs = Environment . GetEnvironmentVariable ( "YDB_EF_CONN" ) ;
87+ if ( string . IsNullOrWhiteSpace ( cs ) ) return ;
88+
89+ var opts = new DbContextOptionsBuilder < MappingOnlyContext > ( )
90+ . UseYdb ( cs )
91+ . Options ;
92+
93+ await using var ctx = new MappingOnlyContext ( opts ) ;
94+
95+ try
96+ {
97+ await ctx . Database . EnsureCreatedAsync ( ) ;
98+ }
99+ catch ( Exception ex ) when ( ex . ToString ( )
100+ . Contains ( "EnableParameterizedDecimal" , StringComparison . OrdinalIgnoreCase ) )
101+ {
102+ return ;
103+ }
104+
105+ var v = 123.4567890123m ;
106+ ctx . Add ( new MappingEntity { Price = v } ) ;
107+ await ctx . SaveChangesAsync ( ) ;
108+
109+ var got = await ctx . Set < MappingEntity > ( ) . Where ( x => x . Price == v ) . ToListAsync ( ) ;
110+ Assert . Single ( got ) ;
111+ Assert . Equal ( v , got [ 0 ] . Price ) ;
112+ }
113+
83114 private sealed class MappingOnlyContext ( DbContextOptions < MappingOnlyContext > options ) : DbContext ( options )
84115 {
85116 protected override void OnModelCreating ( ModelBuilder b )
You can’t perform that action at this time.
0 commit comments