public static void SetGeneratedBarkerERModel(BarkerERModelGenerationSetting element, global::ORMSolutions.ORMArchitect.EntityRelationshipModels.Barker.BarkerErModel newGeneratedBarkerERModel) { DslModeling::DomainRoleInfo.SetLinkedElement(element, GenerationSettingDomainRoleId, newGeneratedBarkerERModel); }
/// <summary> /// Constructor /// Creates a GenerationSettingTargetsBarkerERModel link in the same Partition as the given BarkerERModelGenerationSetting /// </summary> /// <param name="source">BarkerERModelGenerationSetting to use as the source of the relationship.</param> /// <param name="target">BarkerErModel to use as the target of the relationship.</param> public GenerationSettingTargetsBarkerERModel(BarkerERModelGenerationSetting source, global::ORMSolutions.ORMArchitect.EntityRelationshipModels.Barker.BarkerErModel target) : base((source != null ? source.Partition : null), new DslModeling::RoleAssignment[]{new DslModeling::RoleAssignment(GenerationSettingTargetsBarkerERModel.GenerationSettingDomainRoleId, source), new DslModeling::RoleAssignment(GenerationSettingTargetsBarkerERModel.GeneratedBarkerERModelDomainRoleId, target)}, null) { }
public static global::ORMSolutions.ORMArchitect.EntityRelationshipModels.Barker.BarkerErModel GetGeneratedBarkerERModel(BarkerERModelGenerationSetting element) { return DslModeling::DomainRoleInfo.GetLinkedElement(element, GenerationSettingDomainRoleId) as global::ORMSolutions.ORMArchitect.EntityRelationshipModels.Barker.BarkerErModel; }
/// <summary> /// Verify that an abstraction model has an appropriate Barker ER model and bridge /// </summary> protected override void ProcessElement(AbstractionModel element, Store store, INotifyElementAdded notifyAdded) { BarkerErModel barkerModel = BarkerErModelIsForAbstractionModel.GetBarkerErModel(element); if (barkerModel == null) { // Create the initial Barker ER model and notify barkerModel = new BarkerErModel( store, new PropertyAssignment[] { new PropertyAssignment(BarkerErModel.NameDomainPropertyId, element.Name) }); new BarkerErModelIsForAbstractionModel(barkerModel, element); BarkerERModelGenerationSetting generationSetting = new BarkerERModelGenerationSetting(store, new PropertyAssignment( BarkerERModelGenerationSetting.CoreAlgorithmVersionDomainPropertyId, CurrentCoreAlgorithmVersion), new PropertyAssignment( BarkerERModelGenerationSetting.NameAlgorithmVersionDomainPropertyId, CurrentNameAlgorithmVersion)); new GenerationSettingTargetsBarkerERModel(generationSetting, barkerModel); new ORMCore.GenerationStateHasGenerationSetting(ORMCore.GenerationState.EnsureGenerationState(store), generationSetting); notifyAdded.ElementAdded(barkerModel, true); FullyGenerateBarkerERModel(barkerModel, element, notifyAdded); } else { BarkerERModelGenerationSetting generationSetting = GenerationSettingTargetsBarkerERModel.GetGenerationSetting(barkerModel); bool regenerateAll = generationSetting == null || generationSetting.CoreAlgorithmVersion != CurrentCoreAlgorithmVersion; bool regenerateNames = false; if (!regenerateAll) { foreach (EntityType barkerEntity in barkerModel.EntityTypeCollection) { if (null == EntityTypeIsPrimarilyForConceptType.GetLinkToConceptType(barkerEntity)) { regenerateAll = true; break; } // Theoretically we should also check that all attributes and uniqueness constraints // are pathed back to the abstraction model. However, this is far from a full validation, // and the scenario we're trying to cover is the abstraction model regenerating during // load and removing our bridge elements. The entity type check above is sufficient. } regenerateNames = !regenerateAll && generationSetting.NameAlgorithmVersion != CurrentNameAlgorithmVersion; generationSetting.NameAlgorithmVersion = CurrentNameAlgorithmVersion; } else { if (generationSetting == null) { generationSetting = new BarkerERModelGenerationSetting(store, new PropertyAssignment( BarkerERModelGenerationSetting.CoreAlgorithmVersionDomainPropertyId, CurrentCoreAlgorithmVersion), new PropertyAssignment( BarkerERModelGenerationSetting.NameAlgorithmVersionDomainPropertyId, CurrentNameAlgorithmVersion)); new GenerationSettingTargetsBarkerERModel(generationSetting, barkerModel); new ORMCore.GenerationStateHasGenerationSetting(ORMCore.GenerationState.EnsureGenerationState(store), generationSetting); } else { regenerateNames = generationSetting.NameAlgorithmVersion != CurrentNameAlgorithmVersion; generationSetting.CoreAlgorithmVersion = CurrentCoreAlgorithmVersion; generationSetting.NameAlgorithmVersion = CurrentNameAlgorithmVersion; } } if (regenerateAll) { barkerModel.BinaryAssociationCollection.Clear(); barkerModel.EntityTypeCollection.Clear(); barkerModel.ExclusiveArcCollection.Clear(); FullyGenerateBarkerERModel(barkerModel, element, notifyAdded); } else if (regenerateNames) { //NameGeneration.GenerateAllNames(barkerModel); } } }