Ejemplo n.º 1
0
 public static Bubble AddBuble(Participant participant, LocalProcess localProcess)
 {
     using (DaemonEntities entities = new DaemonEntities())
     {
         try
         {
             entities.Attach(participant);
             entities.Attach(localProcess);
             Bubble bubble = new Bubble
             {
                 BubbleId        = Guid.NewGuid(),
                 Participant     = participant,
                 LocalProcess    = localProcess,
                 Name            = "New Bubble",
                 Range           = 100,
                 PerceptionRange = 150,
                 Published       = false
             };
             entities.AddToBubble(bubble);
             entities.SaveChanges();
             entities.Detach(bubble);
             return(bubble);
         }
         finally
         {
             entities.Detach(participant);
             entities.Detach(localProcess);
         }
     }
 }