private static void DelayValidateSchemaNameChanged(ModelElement element) { if (!element.IsDeleted) { Schema schema = (Schema)element; // Disable customization tracking during any name change to // avoid redundant processing. SchemaCustomization customization = SchemaCustomization.SetCustomization(schema, null); AbstractionModel abstractionModel; string schemaName; if (customization != null && null != (schemaName = customization.CustomizedSchemaName)) { schema.Name = schemaName; } else if (null != (abstractionModel = SchemaIsForAbstractionModel.GetAbstractionModel(schema))) { schema.Name = abstractionModel.Name; } if (customization != null) { // Don't regenerate the customization object for a schema name change, // just use the previous settings. SchemaCustomization.SetCustomization(schema, customization); } } }
/// <summary> /// ChangeRule: typeof(ORMSolutions.ORMArchitect.ORMAbstraction.AbstractionModel) /// Update the schema name when the abstraction model name changes /// </summary> private static void AbstractionModelChangedRule(ElementPropertyChangedEventArgs e) { if (e.DomainProperty.Id == AbstractionModel.NameDomainPropertyId) { AbstractionModel abstractionModel = (AbstractionModel)e.ModelElement; Schema schema = SchemaIsForAbstractionModel.GetSchema(abstractionModel); if (schema != null && !schema.CustomName) { schema.Name = abstractionModel.Name; } } }
private static void RebuildForAbstractionModelDelayed(ModelElement element) { if (!element.IsDeleted) { AbstractionModel model = (AbstractionModel)element; Schema schema = SchemaIsForAbstractionModel.GetSchema(model); if (schema != null) { // Clear any customizations to stop rules and events from modifying // the customizations during rebuild. SchemaCustomization initialCustomization = SchemaCustomization.SetCustomization(schema, null); schema.TableCollection.Clear(); schema.DomainCollection.Clear(); FullyGenerateConceptualDatabaseModel(schema, model, initialCustomization, null); SchemaCustomization.SetCustomization(schema, new SchemaCustomization(schema)); } } }