public static void Transact() { MessageQueue file = new MessageQueue(@".\private$\resaVoyage"); file.Formatter = new XmlMessageFormatter(new Type[] { typeof(Voyage) }); Voyage voyage = (Voyage)file.Peek().Body; using (TransactionScope transaction = new TransactionScope()) { Vol.AddReservationVol(voyage.Vol.IdVol, 1, voyage.prenom, voyage.nom); Hotel.InsertReservationHotel(voyage.Hotel.IdHotel, 1, voyage.prenom, voyage.nom); transaction.Complete(); file.Receive(); } file.Close(); }