@@ -21,8 +21,13 @@ static SloTableContext()
2121 public sealed class Linq2dbClient
2222 {
2323 private readonly string _connectionString ;
24- public Linq2dbClient ( string connectionString ) => _connectionString = connectionString ;
25- public DataConnection Open ( ) => new DataConnection ( "YDB" , _connectionString ) ;
24+
25+ public Linq2dbClient ( string connectionString )
26+ {
27+ _connectionString = connectionString ;
28+ }
29+
30+ public DataConnection Open ( ) => new ( "YDB" , _connectionString ) ;
2631 }
2732
2833 protected override Linq2dbClient CreateClient ( Config config ) => new ( config . ConnectionString ) ;
@@ -31,7 +36,7 @@ protected override async Task Create(Linq2dbClient client, int operationTimeout)
3136 {
3237 await using var db = client . Open ( ) ;
3338 db . CommandTimeout = operationTimeout ;
34-
39+
3540 await db . ExecuteAsync ( $@ "
3641CREATE TABLE `{ SloTable . Name } ` (
3742 Guid Uuid,
@@ -56,13 +61,13 @@ protected override async Task<int> Save(Linq2dbClient client, SloTable sloTable,
5661
5762 var affected = await db . ExecuteAsync (
5863 sql ,
59- new DataParameter ( "Guid" , sloTable . Guid , DataType . Guid ) ,
60- new DataParameter ( "Id" , sloTable . Id , DataType . Int32 ) ,
61- new DataParameter ( "PayloadStr" , sloTable . PayloadStr , DataType . NVarChar ) ,
62- new DataParameter ( "PayloadDouble" , sloTable . PayloadDouble , DataType . Double ) ,
63- new DataParameter ( "PayloadTimestamp" , sloTable . PayloadTimestamp , DataType . DateTime2 )
64+ new DataParameter ( "Guid" , sloTable . Guid , DataType . Guid ) ,
65+ new DataParameter ( "Id" , sloTable . Id , DataType . Int32 ) ,
66+ new DataParameter ( "PayloadStr" , sloTable . PayloadStr , DataType . NVarChar ) ,
67+ new DataParameter ( "PayloadDouble" , sloTable . PayloadDouble , DataType . Double ) ,
68+ new DataParameter ( "PayloadTimestamp" , sloTable . PayloadTimestamp , DataType . DateTime2 )
6469 ) ;
65-
70+
6671 return affected > 0 ? affected : 1 ;
6772 }
6873
@@ -86,8 +91,8 @@ private sealed class SloRow
8691 {
8792 [ Column ] public Guid Guid { get ; set ; }
8893 [ Column ] public int Id { get ; set ; }
89- [ Column ] public string ? PayloadStr { get ; set ; }
90- [ Column ] public double PayloadDouble { get ; set ; }
94+ [ Column ] public string ? PayloadStr { get ; set ; }
95+ [ Column ] public double PayloadDouble { get ; set ; }
9196 [ Column ] public DateTime PayloadTimestamp { get ; set ; }
9297 }
9398}
0 commit comments