public void One() { var db = new DataContext("connString"); var emp = db.GetTable<HR_Employee>().First(); HR_VoucherDetail detail = new HR_VoucherDetail(); detail.HR_Employee = emp; Assert.AreEqual(1, db.GetChangeSet().Inserts.Count()); } public void Two() { var db = new DataContext("connString"); var emp = db.GetTable<HR_Employee>().First(); HR_VoucherDetail detail = new HR_VoucherDetail(); detail.EmployeeId = emp.EmployeeId; db.GetTable<HR_VoucherDetail>().InsertOnSubmit(detail); Assert.AreEqual(1, db.GetChangeSet().Inserts.Count()); }