/// <summary> /// Creates and adds a new IACConfig-Entry to ConfigItemsSource. /// The implementing class creates a new entity object an add it to its "own Configuration-Table". /// It sets automatically the IACConfig.KeyACUrl-Property with this ACConfigKeyACUrl. /// </summary> /// <param name="acObject">Optional: Reference to another Entity-Object that should be related for this new configuration entry.</param> /// <param name="valueTypeACClass">The iPlus-Type of the "Value"-Property.</param> /// <returns>IACConfig as a new entry</returns> public IACConfig NewACConfig(IACObjectEntity acObject = null, gip.core.datamodel.ACClass valueTypeACClass = null, string localConfigACUrl = null) { InOrderConfig acConfig = InOrderConfig.NewACObject(this.GetObjectContext <MyCompanyDB>(), this); acConfig.KeyACUrl = ACConfigKeyACUrl; acConfig.LocalConfigACUrl = localConfigACUrl; acConfig.ValueTypeACClass = valueTypeACClass; InOrderConfig_InOrder.Add(acConfig); ACConfigListCache.Add(acConfig); return(acConfig); }
/// <summary>Removes a configuration from ConfigurationEntries and the database-context.</summary> /// <param name="acObject">Entry as IACConfig</param> public void RemoveACConfig(IACConfig acObject) { InOrderConfig acConfig = acObject as InOrderConfig; if (acConfig == null) { return; } if (ACConfigListCache.Contains(acConfig)) { ACConfigListCache.Remove(acConfig); } InOrderConfig_InOrder.Remove(acConfig); if (acConfig.EntityState != System.Data.EntityState.Detached) { acConfig.DeleteACObject(this.GetObjectContext <MyCompanyDB>(), false); } }