private static void MedicalDTC() { using (TransactionScope scope = new TransactionScope()) { var token = TransactionInterop.GetTransmitterPropagationToken(Transaction.Current); MedicalContext.MedicalContext medicalContext = new MedicalContext.MedicalContext(); medicalContext.Student.Add(new MedicalContext.Student() { Name = "student from medical " }); string sessionToken = GetSessionTokenFromAdo(); string sessionToken2 = GetSessionTokenFromDbContext(medicalContext); medicalContext.SaveChanges(); CallingBackOffice(sessionToken2); scope.Complete(); } var x = ""; }
private static string GetSessionTokenFromDbContext(MedicalContext.MedicalContext dbContextNet1) { return(dbContextNet1.SessionToken.FromSqlRaw(@"DECLARE @bind_token varchar(255); EXECUTE sp_getbindtoken @bind_token OUTPUT; SELECT @bind_token AS Token; ").AsEnumerable().First().Token); }