Beispiel #1
0
        /// <summary>
        /// Unregisters the previously registered data.
        /// </summary>
        /// <param name="data">The application data.</param>
        /// <param name="name">The name of the data.</param>
        /// <remarks>
        /// You must specify the same <b>data</b> and <b>name</b> as when you call <b>RegisterData</b>.
        /// </remarks>
        public void UnregisterData(object data, string name)
        {
            for (int i = 0; i < FRegisteredItems.Count; i++)
            {
                RegDataItem item = FRegisteredItems[i];
                if (item.Name == name)
                {
                    FRegisteredItems.RemoveAt(i);
                    break;
                }
            }

            DataComponentBase comp = FindDataComponent(name);

            if (comp != null)
            {
                comp.Dispose();
            }

            if (data is DataSet)
            {
                foreach (DataTable table in (data as DataSet).Tables)
                {
                    UnregisterData(table, name + "." + table.TableName);
                }
                foreach (DataRelation relation in (data as DataSet).Relations)
                {
                    UnregisterData(relation, name + "." + relation.RelationName);
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// Finds a data component that matches the specified reference name.
 /// </summary>
 /// <param name="referenceName">The name to check.</param>
 /// <returns>The <b>DataComponentBase</b> object if found.</returns>
 /// <remarks>
 /// This method is for internal use only.
 /// </remarks>
 public DataComponentBase FindDataComponent(string referenceName)
 {
     foreach (Base c in AllObjects)
     {
         DataComponentBase data = c as DataComponentBase;
         if (data != null && data.ReferenceName == referenceName)
         {
             return(data);
         }
     }
     return(null);
 }