@@ -10,7 +10,7 @@ namespace SpacetimeDB.Modules.ModuleTestCs;
1010// TABLE DEFINITIONS
1111// ─────────────────────────────────────────────────────────────────────────────
1212
13- [ Table ( Name = "Person " , Public = true ) ]
13+ [ Table ( Name = "person " , Public = true ) ]
1414public partial struct Person
1515{
1616 [ PrimaryKey ]
@@ -22,7 +22,7 @@ public partial struct Person
2222 public byte age ;
2323}
2424
25- [ Table ( Name = "TestATable " ) ]
25+ [ Table ( Name = "test_a " ) ]
2626public partial struct TestA
2727{
2828 // The index on column "x" is given the name "foo".
@@ -244,13 +244,13 @@ public static void repeating_test(ReducerContext ctx, RepeatingTestArg arg)
244244 [ Reducer ]
245245 public static void add ( ReducerContext ctx , string name , byte age )
246246 {
247- ctx . Db . Person . Insert ( new Person { id = 0 , name = name , age = age } ) ;
247+ ctx . Db . person . Insert ( new Person { id = 0 , name = name , age = age } ) ;
248248 }
249249
250250 [ Reducer ]
251251 public static void say_hello ( ReducerContext ctx )
252252 {
253- foreach ( var person in ctx . Db . Person . Iter ( ) )
253+ foreach ( var person in ctx . Db . person . Iter ( ) )
254254 {
255255 Log . Info ( $ "Hello, { person . name } !") ;
256256 }
@@ -261,7 +261,7 @@ public static void say_hello(ReducerContext ctx)
261261 public static void list_over_age ( ReducerContext ctx , byte age )
262262 {
263263 // In C# we assume the BTree index filter accepts a tuple representing a range.
264- foreach ( var person in ctx . Db . Person . age . Filter ( ( age , byte . MaxValue ) ) )
264+ foreach ( var person in ctx . Db . person . age . Filter ( ( age , byte . MaxValue ) ) )
265265 {
266266 Log . Info ( $ "{ person . name } has age { person . age } >= { age } ") ;
267267 }
@@ -310,25 +310,25 @@ public static void test(ReducerContext ctx, TestAlias arg, TestB arg2, TestC arg
310310 // Insert 1000 rows into the test_a table.
311311 for ( uint i = 0 ; i < 1000 ; i ++ )
312312 {
313- ctx . Db . TestATable . Insert ( new TestA
313+ ctx . Db . test_a . Insert ( new TestA
314314 {
315315 x = i + arg . x ,
316316 y = i + arg . y ,
317317 z = "Yo"
318318 } ) ;
319319 }
320320
321- var rowCountBeforeDelete = ctx . Db . TestATable . Count ;
321+ var rowCountBeforeDelete = ctx . Db . test_a . Count ;
322322 Log . Info ( $ "Row count before delete: { rowCountBeforeDelete } ") ;
323323
324324 ulong numDeleted = 0 ;
325325 // Delete rows using the "foo" index (from 5 up to, but not including, 10).
326326 for ( uint row = 5 ; row < 10 ; row ++ )
327327 {
328- numDeleted += ctx . Db . TestATable . foo . Delete ( row ) ;
328+ numDeleted += ctx . Db . test_a . foo . Delete ( row ) ;
329329 }
330330
331- var rowCountAfterDelete = ctx . Db . TestATable . Count ;
331+ var rowCountAfterDelete = ctx . Db . test_a . Count ;
332332
333333 if ( rowCountBeforeDelete != rowCountAfterDelete + numDeleted )
334334 {
@@ -353,8 +353,8 @@ public static void test(ReducerContext ctx, TestAlias arg, TestB arg2, TestC arg
353353
354354 Log . Info ( $ "Row count after delete: { rowCountAfterDelete } ") ;
355355
356- // Here we simply count the rows in TestATable again (this could be replaced with a filtered count).
357- var otherRowCount = ctx . Db . TestATable . Count ;
356+ // Here we simply count the rows in test_a again (this could be replaced with a filtered count).
357+ var otherRowCount = ctx . Db . test_a . Count ;
358358 Log . Info ( $ "Row count filtered by condition: { otherRowCount } ") ;
359359
360360 Log . Info ( "MultiColumn" ) ;
0 commit comments