Hi
I'm trying the following code
UserDetail ud = UserDetail.SingleOrDefault(u => u.UserName == CurrentUserName);
if (ud == null)
ud = new UserDetail();
Address uAddress = ud.AddressId.HasValue
? Address.SingleOrNew(a => a.Id == ud.AddressId)
: new Address();
using (TransactionScope tc = new TransactionScope())
{
uAddress.Save();
ud.AddressId = uAddress.Id;
ud.Save(); // error is here
tc.Complete();
}
when i reach ud.save() i get the error 'The operation is not valid for the state of the transaction. ---> System.Transactions.TransactionPromotionException: Failure while attempting to promote transaction'
if i comment out the transaction part it works fine, isn't .SingleOrDefault disconnecting from the db ?
thanks