示例#1
0
 public static ObjectType AddObjectType(Participant participant)
 {
     using (DaemonEntities entities = new DaemonEntities())
     {
         try
         {
             entities.Attach(participant);
             ObjectType objectType = new ObjectType
             {
                 ObjectTypeId = Guid.NewGuid(),
                 Participant  = participant,
                 Name         = "New Object Type",
                 Radius       = 11,
                 Mass         = 10,
                 ModelUrl     = "http://",
                 ModelScale   = 10,
                 Published    = false
             };
             entities.AddToObjectType(objectType);
             entities.SaveChanges();
             entities.Detach(objectType);
             return(objectType);
         }
         finally
         {
             entities.Detach(participant);
         }
     }
 }