当将 ClaimDetail 添加到 tmpClaim 时,此 ClaimDetail 也会添加到声明中。有人可以解释一下为什么会这样吗?
List<Claim> claims; // list data
foreach ( Claim claim in claims) {
Claim tmpClaim = datacontext.Claims.FirstOrDefault ( c => c.Id == claim.Id );
ClaimDetail claimDetail = new ClaimDetail ( );
claimDetail.ClaimDetailType = "Type";
// add claim
datacontext.Claims.InsertOnSubmit ( tmpClaim );
datacontext.SubmitChanges ( );
}
月关宝盒
相关分类