Esempio n. 1
0
 /// <summary>
 /// Removes all members from the conceptual model.
 /// </summary>
 public void Clear()
 {
     try
     {
         foreach (ModelAssociationSet mas in AssociationSets.ToList())
         {
             mas.Remove();
         }
         foreach (ModelComplexType mct in ComplexTypes.ToList())
         {
             mct.Remove();
         }
         foreach (ModelEntityType met in EntityTypes.ToList())
         {
             met.Remove();
         }
         foreach (ModelEntitySet mes in EntitySets.ToList())
         {
             mes.Remove();
         }
         foreach (ModelFunction mf in FunctionImports.ToList())
         {
             mf.Remove();
         }
     }
     catch (Exception ex)
     {
         try
         {
             if (!ex.Data.Contains("EDMXType"))
             {
                 ex.Data.Add("EDMXType", this.GetType().Name);
             }
             if (!ex.Data.Contains("EDMXObjectName"))
             {
                 ex.Data.Add("EDMXObjectName", this.ContainerName);
             }
         }
         catch { }
         throw;
     }
 }