private static void PrimaryKeyForeignKeyTest(IPopulator populator, ICodeGeneratorIntegration codeGeneratorIntegration) { IList<RecordReference<ManualKeyPrimaryTableClass>> primaries = populator.Add<ManualKeyPrimaryTableClass>(2); IList<RecordReference<ManualKeyForeignTable>> foreignSet1 = populator.Add<ManualKeyForeignTable>(2); foreignSet1.ToList().ForEach(f => f.AddPrimaryRecordReference(primaries[0])); IList<RecordReference<ManualKeyForeignTable>> foreignSet2 = populator.Add<ManualKeyForeignTable>(2); foreignSet2.ToList().ForEach(f => f.AddPrimaryRecordReference(primaries[1])); codeGeneratorIntegration.AddTypes(populator, foreignSet1, foreignSet2); primaries[0].Set(o => o.ADecimal, 112233.445566m).Set(o => o.AString, "AAXX").Set(o => o.Key1, "HummHummHumm"); foreignSet2[1].Set(o => o.ALong, 11111L).Set(o => o.AShort, (short) 1234); using (var transactionScope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions {IsolationLevel = IsolationLevel.ReadCommitted})) { populator.Bind(); //transactionScope.Complete(); } Helpers.Dump(primaries); Helpers.Dump(foreignSet1); Helpers.Dump(foreignSet2); codeGeneratorIntegration.Dump(); Console.WriteLine(); Console.WriteLine(foreignSet1[0].RecordObject.ForeignKey1); Console.WriteLine(foreignSet1[1].RecordObject.ForeignKey1); Console.WriteLine(foreignSet2[0].RecordObject.ForeignKey1); Console.WriteLine(foreignSet2[1].RecordObject.ForeignKey1); }