@@ -1191,6 +1191,61 @@ public void delete_record_with_calculated_partition_key_using_date()
11911191 Assert . AreEqual ( 3 , tableStore . GetRecordCount ( ) ) ;
11921192
11931193 }
1194+
1195+
1196+ [ TestMethod ]
1197+ public void insert_record_with_calculated_partition_key_from_multiple_properties ( )
1198+ {
1199+ tableStore = new PocoTableStore < Employee , int , int > ( "TestEmployee" , "UseDevelopmentStorage=true" ,
1200+ partitionProperty : null , rowProperty : e => e . Id , calculatedPartitionKey : e => e . CompanyId + "." + e . Department . Id , calculatedRowKey : e => e . Id . ToString ( ) ,
1201+ calculatedPartitionKeyFromParameter : x => null ,
1202+ calculatedRowKeyFromParameter : x => x . ToString ( ) ,
1203+ convertPartitionKey : null , convertRowKey : int . Parse ) ;
1204+
1205+ var employee = new Employee
1206+ {
1207+ CompanyId = 1 ,
1208+ Id = 1 ,
1209+ Name = "Mr. Jim CEO" ,
1210+ Department = new Department { Id = 22 , Name = "Executive" }
1211+ } ;
1212+ tableStore . Insert ( employee ) ;
1213+
1214+ var ts = new TableStore < DynamicTableEntity > ( "TestEmployee" , "UseDevelopmentStorage=true" ) ;
1215+ var record = ts . GetRecord ( "1.22" , "1" ) ;
1216+
1217+ Assert . AreEqual ( "1.22" , record . PartitionKey ) ;
1218+ Assert . AreEqual ( "1" , record . RowKey ) ;
1219+ Assert . AreEqual ( "Mr. Jim CEO" , record . Properties [ "Name" ] . StringValue ) ;
1220+
1221+ }
1222+
1223+ [ TestMethod ]
1224+ public void get_record_with_calculated_partition_key_from_multiple_properties ( )
1225+ {
1226+ tableStore = new PocoTableStore < Employee , int , int > ( "TestEmployee" , "UseDevelopmentStorage=true" ,
1227+ partitionProperty : null , rowProperty : e => e . Id , calculatedPartitionKey : e => e . CompanyId + "." + e . Department . Id , calculatedRowKey : e => e . Id . ToString ( ) ,
1228+ calculatedPartitionKeyFromParameter : x => null ,
1229+ calculatedRowKeyFromParameter : x => x . ToString ( ) ,
1230+ convertPartitionKey : null , convertRowKey : int . Parse ) ;
1231+
1232+ var employee = new Employee
1233+ {
1234+ CompanyId = 1 ,
1235+ Id = 1 ,
1236+ Name = "Mr. Jim CEO" ,
1237+ Department = new Department { Id = 22 , Name = "Executive" }
1238+ } ;
1239+ tableStore . Insert ( employee ) ;
1240+
1241+ var record = tableStore . GetRecord ( "1.22" , "1" ) ;
1242+
1243+ Assert . AreEqual ( 1 , record . Id ) ;
1244+ Assert . AreEqual ( 22 , record . Department . Id ) ;
1245+ Assert . AreEqual ( "Mr. Jim CEO" , record . Name ) ;
1246+
1247+ }
1248+
11941249 [ TestCleanup ]
11951250 public void Cleanup ( )
11961251 {
0 commit comments