///-------------------------------------------------------------------------------- /// <summary>This method refreshes the view model.</summary> /// /// <param name="refreshChildren">Flag indicating whether children should be refreshed.</param> ///-------------------------------------------------------------------------------- public void Refresh(bool refreshChildren, int refreshLevel = 0) { if (refreshChildren == true || refreshLevel > 0) { } #region protected #endregion protected HasErrors = !StepTransition.IsValid; HasCustomizations = StepTransition.IsAutoUpdated == false || StepTransition.IsEmptyMetadata(StepTransition.ForwardInstance) == false || ChildrenHaveAnyCustomizations(); if (HasCustomizations == false && StepTransition.ReverseInstance != null) { // remove customizations if solely due to child customizations no longer present StepTransition.IsAutoUpdated = true; StepTransition.SpecSourceName = StepTransition.ReverseInstance.SpecSourceName; StepTransition.ResetModified(StepTransition.ReverseInstance.IsModified); StepTransition.ResetLoaded(StepTransition.ReverseInstance.IsLoaded); if (!StepTransition.IsIdenticalMetadata(StepTransition.ReverseInstance)) { HasCustomizations = true; StepTransition.IsAutoUpdated = false; } } if (HasCustomizations == false) { // clear customizations StepTransition.ForwardInstance = null; StepTransition.ReverseInstance = null; StepTransition.IsAutoUpdated = true; } OnPropertyChanged("Items"); OnPropertyChanged("HasCustomizations"); OnPropertyChanged("HasErrors"); }
///-------------------------------------------------------------------------------- /// <summary>This method loads an item of StepTransition into the view model.</summary> /// /// <param name="stepTransition">The StepTransition to load.</param> /// <param name="loadChildren">Flag indicating whether to perform a deeper load.</param> ///-------------------------------------------------------------------------------- public void LoadStepTransition(StepTransition stepTransition, bool loadChildren = true) { // attach the StepTransition StepTransition = stepTransition; ItemID = StepTransition.StepTransitionID; Items.Clear(); if (loadChildren == true) { #region protected #endregion protected Refresh(false); } }
public void StepTransitionCreatingIndexCompare() { // Подготовка uint index = 15; decimal stepValue = 0.5m; decimal coordinate = 25m; var expected = new StepTransition { Index = 15, StepValue = stepValue, Coordinate = coordinate }; // Действие var stepTransition = new StepTransition(index, stepValue, coordinate); // Проверка Assert.Equal(expected.Index, stepTransition.Index); }
///-------------------------------------------------------------------------------- /// <summary>This method sets the default values.</summary> ///-------------------------------------------------------------------------------- protected override void OnSetDefaults() { if (StepTransition.ReverseInstance != null) { EditStepTransition.TransformDataFromObject(StepTransition.ReverseInstance, null, false); } else if (StepTransition.IsAutoUpdated == true) { EditStepTransition.TransformDataFromObject(StepTransition, null, false); } else { StepTransition newStepTransition = new StepTransition(); newStepTransition.StepTransitionID = EditStepTransition.StepTransitionID; EditStepTransition.TransformDataFromObject(newStepTransition, null, false); } EditStepTransition.ResetModified(true); }
///-------------------------------------------------------------------------------- /// <summary>Interpret this node to produce code, output, or model data..</summary> /// /// <param name="interpreterType">The type of interpretation to perform.</param> /// <param name="solutionContext">The associated solution.</param> /// <param name="templateContext">The associated template.</param> /// <param name="modelContext">The associated model context.</param> ///-------------------------------------------------------------------------------- public void InterpretNode(InterpreterTypeCode interpreterType, Solution solutionContext, ITemplate templateContext, IDomainEnterpriseObject modelContext) { try { if (CurrentItem != null) { if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentAuditProperty)) { if (solutionContext.CurrentAuditProperty != null) { AuditProperty.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- AuditProperty: ").Append(solutionContext.CurrentAuditProperty.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentCollection)) { if (solutionContext.CurrentCollection != null) { Collection.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Collection: ").Append(solutionContext.CurrentCollection.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentEntity)) { if (solutionContext.CurrentEntity != null) { Entity.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Entity: ").Append(solutionContext.CurrentEntity.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentEntityReference)) { if (solutionContext.CurrentEntityReference != null) { EntityReference.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- EntityReference: ").Append(solutionContext.CurrentEntityReference.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentEnumeration)) { if (solutionContext.CurrentEnumeration != null) { Enumeration.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Enumeration: ").Append(solutionContext.CurrentEnumeration.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentFeature)) { if (solutionContext.CurrentFeature != null) { Feature.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Feature: ").Append(solutionContext.CurrentFeature.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentIndex)) { if (solutionContext.CurrentIndex != null) { Index.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Index: ").Append(solutionContext.CurrentIndex.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentIndexProperty)) { if (solutionContext.CurrentIndexProperty != null) { IndexProperty.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- IndexProperty: ").Append(solutionContext.CurrentIndexProperty.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentMethod)) { if (solutionContext.CurrentMethod != null) { Method.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Method: ").Append(solutionContext.CurrentMethod.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentMethodRelationship)) { if (solutionContext.CurrentMethodRelationship != null) { MethodRelationship.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- MethodRelationship: ").Append(solutionContext.CurrentMethodRelationship.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentModel)) { if (solutionContext.CurrentModel != null) { Model.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Model: ").Append(solutionContext.CurrentModel.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentModelObject)) { if (solutionContext.CurrentModelObject != null) { ModelObject.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- ModelObject: ").Append(solutionContext.CurrentModelObject.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentModelProperty)) { if (solutionContext.CurrentModelProperty != null) { ModelProperty.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- ModelProperty: ").Append(solutionContext.CurrentModelProperty.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentObjectInstance)) { if (solutionContext.CurrentObjectInstance != null) { ObjectInstance.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- ObjectInstance: ").Append(solutionContext.CurrentObjectInstance.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentParameter)) { if (solutionContext.CurrentParameter != null) { Parameter.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Parameter: ").Append(solutionContext.CurrentParameter.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentProject)) { if (solutionContext.CurrentProject != null) { Project.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Project: ").Append(solutionContext.CurrentProject.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentProperty)) { if (solutionContext.CurrentProperty != null) { Property.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Property: ").Append(solutionContext.CurrentProperty.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentPropertyInstance)) { if (solutionContext.CurrentPropertyInstance != null) { PropertyInstance.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- PropertyInstance: ").Append(solutionContext.CurrentPropertyInstance.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentPropertyReference)) { if (solutionContext.CurrentPropertyReference != null) { PropertyReference.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- PropertyReference: ").Append(solutionContext.CurrentPropertyReference.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentPropertyRelationship)) { if (solutionContext.CurrentPropertyRelationship != null) { PropertyRelationship.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- PropertyRelationship: ").Append(solutionContext.CurrentPropertyRelationship.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentRelationship)) { if (solutionContext.CurrentRelationship != null) { Relationship.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Relationship: ").Append(solutionContext.CurrentRelationship.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentRelationshipProperty)) { if (solutionContext.CurrentRelationshipProperty != null) { RelationshipProperty.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- RelationshipProperty: ").Append(solutionContext.CurrentRelationshipProperty.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStage)) { if (solutionContext.CurrentStage != null) { Stage.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Stage: ").Append(solutionContext.CurrentStage.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStageTransition)) { if (solutionContext.CurrentStageTransition != null) { StageTransition.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- StageTransition: ").Append(solutionContext.CurrentStageTransition.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentState)) { if (solutionContext.CurrentState != null) { State.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- State: ").Append(solutionContext.CurrentState.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStateModel)) { if (solutionContext.CurrentStateModel != null) { StateModel.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- StateModel: ").Append(solutionContext.CurrentStateModel.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStateTransition)) { if (solutionContext.CurrentStateTransition != null) { StateTransition.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- StateTransition: ").Append(solutionContext.CurrentStateTransition.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStep)) { if (solutionContext.CurrentStep != null) { Step.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Step: ").Append(solutionContext.CurrentStep.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStepTransition)) { if (solutionContext.CurrentStepTransition != null) { StepTransition.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- StepTransition: ").Append(solutionContext.CurrentStepTransition.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentValue)) { if (solutionContext.CurrentValue != null) { Value.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Value: ").Append(solutionContext.CurrentValue.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentView)) { if (solutionContext.CurrentView != null) { View.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- View: ").Append(solutionContext.CurrentView.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentViewProperty)) { if (solutionContext.CurrentViewProperty != null) { ViewProperty.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- ViewProperty: ").Append(solutionContext.CurrentViewProperty.InnerXmlData); } } } else if (CurrentItem.CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentWorkflow)) { if (solutionContext.CurrentWorkflow != null) { Workflow.DeleteCurrentItemFromSolution(solutionContext); if (solutionContext.IsSampleMode == true) { templateContext.MessageBuilder.Append("\r\n- Workflow: ").Append(solutionContext.CurrentWorkflow.InnerXmlData); } } } #region protected #endregion protected else { LogException(solutionContext, templateContext, modelContext, String.Format(DisplayValues.Exception_CouldNotDeleteItem, CurrentItem.CurrentItemName), interpreterType); } } } catch (ApplicationAbortException) { throw; } catch (System.Exception ex) { LogException(solutionContext, templateContext, modelContext, ex, interpreterType); } }
///-------------------------------------------------------------------------------- /// <summary>This method gets the collection context associated with this node.</summary> /// /// <param name="solutionContext">The associated solution.</param> /// <param name="templateContext">The associated template.</param> /// <param name="modelContext">The associated model context.</param> ///-------------------------------------------------------------------------------- public IEnterpriseEnumerable GetCollection(Solution solutionContext, ITemplate templateContext, IDomainEnterpriseObject modelContext) { IDomainEnterpriseObject nodeContext = modelContext; if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentAuditProperty)) { return(AuditProperty.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentCollection)) { return(Collection.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentEntity)) { return(Entity.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentEntityReference)) { return(EntityReference.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentEnumeration)) { return(Enumeration.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentFeature)) { return(Feature.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentIndex)) { return(Index.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentIndexProperty)) { return(IndexProperty.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentMethod)) { return(Method.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentMethodRelationship)) { return(MethodRelationship.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentModel)) { return(Model.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentModelObject)) { return(ModelObject.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentModelProperty)) { return(ModelProperty.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentObjectInstance)) { return(ObjectInstance.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentParameter)) { return(Parameter.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentProject)) { return(Project.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentProperty)) { return(Property.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentPropertyInstance)) { return(PropertyInstance.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentPropertyReference)) { return(PropertyReference.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentPropertyRelationship)) { return(PropertyRelationship.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentRelationship)) { return(Relationship.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentRelationshipProperty)) { return(RelationshipProperty.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStage)) { return(Stage.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStageTransition)) { return(StageTransition.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentState)) { return(State.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStateModel)) { return(StateModel.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStateTransition)) { return(StateTransition.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStep)) { return(Step.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentStepTransition)) { return(StepTransition.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentValue)) { return(Value.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentView)) { return(View.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentViewProperty)) { return(ViewProperty.GetCollectionContext(solutionContext, nodeContext)); } else if (CurrentItemName == Enum.GetName(typeof(CurrentItemTypeCode), CurrentItemTypeCode.CurrentWorkflow)) { return(Workflow.GetCollectionContext(solutionContext, nodeContext)); } #region protected #endregion protected else if (solutionContext.ModelObjectNames.AllKeys.Contains(CurrentItemName.Substring(7)) == true) { return(ObjectInstance.GetCollectionContext(solutionContext, CurrentItemName.Substring(7), nodeContext)); } return(null); }
///-------------------------------------------------------------------------------- /// <summary>This method gets the model context associated with this node.</summary> /// /// <param name="solutionContext">The associated solution.</param> /// <param name="templateContext">The associated template.</param> /// <param name="modelContext">The associated model context.</param> /// <param name="isValidContext">Output flag, signifying whether context returned is a valid one.</param> ///-------------------------------------------------------------------------------- public IDomainEnterpriseObject GetModelContext(Solution solutionContext, ITemplate templateContext, IDomainEnterpriseObject modelContext, out bool isValidContext) { IDomainEnterpriseObject nodeContext = modelContext; IDomainEnterpriseObject currentContext = modelContext; ModelContextNode leafModelContext = ModelContext; isValidContext = false; if (ThisContext != null) { templateContext.PopCount = templateContext.ModelContextStack.Count - 1; } else if (PopContext != null) { // go through pop context nodes directly here ModelContextNode contextNode = this; while (contextNode != null) { if (contextNode.PopContext != null) { leafModelContext = contextNode.ModelContext; templateContext.PopCount++; } contextNode = contextNode.ModelContext; } } if (templateContext.PopCount > 0) { // pop context executes first nodeContext = templateContext.GetModelContext(templateContext.PopCount); templateContext.PopCount = 0; } if (leafModelContext != null) { // model context nodes execute next (then, nodes are evaluated) nodeContext = leafModelContext.GetModelContext(solutionContext, templateContext, nodeContext, out isValidContext); } if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.AuditProperty)) { nodeContext = AuditProperty.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Collection)) { nodeContext = Collection.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Entity)) { nodeContext = Entity.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.EntityReference)) { nodeContext = EntityReference.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Enumeration)) { nodeContext = Enumeration.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Feature)) { nodeContext = Feature.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Index)) { nodeContext = Index.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.IndexProperty)) { nodeContext = IndexProperty.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Method)) { nodeContext = Method.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.MethodRelationship)) { nodeContext = MethodRelationship.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Model)) { nodeContext = Model.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.ModelObject)) { nodeContext = ModelObject.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.ModelProperty)) { nodeContext = ModelProperty.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.ObjectInstance)) { nodeContext = ObjectInstance.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Parameter)) { nodeContext = Parameter.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Project)) { nodeContext = Project.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Property)) { nodeContext = Property.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.PropertyInstance)) { nodeContext = PropertyInstance.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.PropertyReference)) { nodeContext = PropertyReference.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.PropertyRelationship)) { nodeContext = PropertyRelationship.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Relationship)) { nodeContext = Relationship.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.RelationshipProperty)) { nodeContext = RelationshipProperty.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Solution)) { nodeContext = Solution.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Stage)) { nodeContext = Stage.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.StageTransition)) { nodeContext = StageTransition.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.State)) { nodeContext = State.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.StateModel)) { nodeContext = StateModel.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.StateTransition)) { nodeContext = StateTransition.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Step)) { nodeContext = Step.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.StepTransition)) { nodeContext = StepTransition.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Value)) { nodeContext = Value.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.View)) { nodeContext = View.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.ViewProperty)) { nodeContext = ViewProperty.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Workflow)) { nodeContext = Workflow.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlColumn)) { nodeContext = SqlColumn.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlDatabase)) { nodeContext = SqlDatabase.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlExtendedProperty)) { nodeContext = SqlExtendedProperty.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlForeignKey)) { nodeContext = SqlForeignKey.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlForeignKeyColumn)) { nodeContext = SqlForeignKeyColumn.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlIndex)) { nodeContext = SqlIndex.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlIndexedColumn)) { nodeContext = SqlIndexedColumn.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlProperty)) { nodeContext = SqlProperty.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlTable)) { nodeContext = SqlTable.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlView)) { nodeContext = SqlView.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlViewProperty)) { nodeContext = SqlViewProperty.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.XmlAttribute)) { nodeContext = XmlAttribute.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.XmlDocument)) { nodeContext = XmlDocument.GetModelContext(solutionContext, nodeContext, out isValidContext); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.XmlNode)) { nodeContext = XmlNode.GetModelContext(solutionContext, nodeContext, out isValidContext); } #region protected else if (ModelContextName == "ReferencedEntity") { currentContext = nodeContext; nodeContext = Collection.GetModelContext(solutionContext, currentContext, out isValidContext); if (nodeContext is Collection) { nodeContext = (nodeContext as Collection).ReferencedEntity; } else { nodeContext = EntityReference.GetModelContext(solutionContext, currentContext, out isValidContext); if (nodeContext is EntityReference) { nodeContext = (nodeContext as EntityReference).ReferencedEntity; } else { nodeContext = Relationship.GetModelContext(solutionContext, currentContext, out isValidContext); if (nodeContext is Relationship) { nodeContext = (nodeContext as Relationship).ReferencedEntity; } else { nodeContext = Parameter.GetModelContext(solutionContext, currentContext, out isValidContext); if (nodeContext is Parameter) { nodeContext = (nodeContext as Parameter).ReferencedEntity; } } } } } else if (ModelContextName == "ReferencedProperty") { currentContext = nodeContext; nodeContext = RelationshipProperty.GetModelContext(solutionContext, currentContext, out isValidContext); if (nodeContext is RelationshipProperty) { nodeContext = (nodeContext as RelationshipProperty).ReferencedProperty; } else { nodeContext = PropertyReference.GetModelContext(solutionContext, currentContext, out isValidContext); if (nodeContext is PropertyReference) { nodeContext = (nodeContext as PropertyReference).ReferencedProperty; } else { nodeContext = Parameter.GetModelContext(solutionContext, currentContext, out isValidContext); if (nodeContext is Parameter) { nodeContext = (nodeContext as Parameter).ReferencedPropertyBase as Property; } } } } else if (ModelContextName == "BaseEntity") { nodeContext = Entity.GetModelContext(solutionContext, nodeContext, out isValidContext); if (nodeContext is Entity) { nodeContext = (nodeContext as Entity).BaseEntity; } } else if (solutionContext.ModelObjectPropertyNames[ModelContextName] != null) { nodeContext = ObjectInstance.GetModelContextViaProperty(solutionContext, ModelContextName, nodeContext, out isValidContext); } #endregion protected else if (solutionContext.ModelObjectNames.AllKeys.Contains(ModelContextName) == true) { return(ObjectInstance.GetModelContext(solutionContext, ModelContextName, nodeContext, out isValidContext)); } if (nodeContext == null && isValidContext == false) { LogException(solutionContext, templateContext, modelContext, String.Format(DisplayValues.Exception_InvalidModelContext, ModelContextName, modelContext.Name, modelContext.GetType().Name), InterpreterTypeCode.None); } return(nodeContext); }
///-------------------------------------------------------------------------------- /// <summary>This method gets the collection context associated with this node.</summary> /// /// <param name="solutionContext">The associated solution.</param> /// <param name="templateContext">The associated template.</param> /// <param name="modelContext">The associated model context.</param> ///-------------------------------------------------------------------------------- public IEnterpriseEnumerable GetCollection(Solution solutionContext, ITemplate templateContext, IDomainEnterpriseObject modelContext) { IDomainEnterpriseObject nodeContext = modelContext; bool isValidContext; if (ModelContext != null) { nodeContext = ModelContext.GetModelContext(solutionContext, templateContext, modelContext, out isValidContext); } if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.AuditProperty)) { return(AuditProperty.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Collection)) { return(Collection.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Entity)) { return(Entity.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.EntityReference)) { return(EntityReference.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Enumeration)) { return(Enumeration.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Feature)) { return(Feature.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Index)) { return(Index.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.IndexProperty)) { return(IndexProperty.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Method)) { return(Method.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.MethodRelationship)) { return(MethodRelationship.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Model)) { return(Model.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.ModelObject)) { return(ModelObject.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.ModelProperty)) { return(ModelProperty.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.ObjectInstance)) { return(ObjectInstance.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Parameter)) { return(Parameter.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Project)) { return(Project.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Property)) { return(Property.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.PropertyInstance)) { return(PropertyInstance.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.PropertyReference)) { return(PropertyReference.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.PropertyRelationship)) { return(PropertyRelationship.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Relationship)) { return(Relationship.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.RelationshipProperty)) { return(RelationshipProperty.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Solution)) { return(Solution.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Stage)) { return(Stage.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.StageTransition)) { return(StageTransition.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.State)) { return(State.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.StateModel)) { return(StateModel.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.StateTransition)) { return(StateTransition.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Step)) { return(Step.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.StepTransition)) { return(StepTransition.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Value)) { return(Value.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.View)) { return(View.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.ViewProperty)) { return(ViewProperty.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Workflow)) { return(Workflow.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlColumn)) { return(SqlColumn.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlDatabase)) { return(SqlDatabase.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlExtendedProperty)) { return(SqlExtendedProperty.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlForeignKey)) { return(SqlForeignKey.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlForeignKeyColumn)) { return(SqlForeignKeyColumn.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlIndex)) { return(SqlIndex.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlIndexedColumn)) { return(SqlIndexedColumn.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlProperty)) { return(SqlProperty.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlTable)) { return(SqlTable.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlView)) { return(SqlView.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.SqlViewProperty)) { return(SqlViewProperty.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.XmlAttribute)) { return(XmlAttribute.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.XmlDocument)) { return(XmlDocument.GetCollectionContext(solutionContext, nodeContext)); } else if (ModelContextName == Enum.GetName(typeof(SpecModelContextTypeCode), SpecModelContextTypeCode.XmlNode)) { return(XmlNode.GetCollectionContext(solutionContext, nodeContext)); } #region protected else if (ModelContextName == Enum.GetName(typeof(ModelContextTypeCode), ModelContextTypeCode.Tag)) { return(Tag.GetCollectionContext(solutionContext, modelContext)); } #endregion protected else if (solutionContext.ModelObjectNames.AllKeys.Contains(ModelContextName) == true) { return(ObjectInstance.GetCollectionContext(solutionContext, ModelContextName, nodeContext)); } LogException(solutionContext, templateContext, modelContext, String.Format(DisplayValues.Exception_InvalidModelContext, ModelContextName, modelContext.GetType().Name), InterpreterTypeCode.None); return(null); }
///-------------------------------------------------------------------------------- /// <summary>This method updates the view model data and sends update command back /// to the solution builder.</summary> ///-------------------------------------------------------------------------------- protected override void OnUpdate() { // set up reverse engineering instance if not present if (StepTransition.ReverseInstance == null && StepTransition.IsAutoUpdated == true) { StepTransition.ReverseInstance = new StepTransition(); StepTransition.ReverseInstance.TransformDataFromObject(StepTransition, null, false); // perform the update of EditStepTransition back to StepTransition StepTransition.TransformDataFromObject(EditStepTransition, null, false); StepTransition.IsAutoUpdated = false; } else if (StepTransition.ReverseInstance != null) { EditStepTransition.ResetModified(StepTransition.ReverseInstance.IsModified); if (EditStepTransition.Equals(StepTransition.ReverseInstance)) { // perform the update of EditStepTransition back to StepTransition StepTransition.TransformDataFromObject(EditStepTransition, null, false); StepTransition.IsAutoUpdated = true; } else { // perform the update of EditStepTransition back to StepTransition StepTransition.TransformDataFromObject(EditStepTransition, null, false); StepTransition.IsAutoUpdated = false; } } else { // perform the update of EditStepTransition back to StepTransition StepTransition.TransformDataFromObject(EditStepTransition, null, false); StepTransition.IsAutoUpdated = false; } StepTransition.ForwardInstance = null; if (StepTransitionNameCustomized || FromStepIDCustomized || DescriptionCustomized || TagsCustomized) { StepTransition.ForwardInstance = new StepTransition(); StepTransition.ForwardInstance.StepTransitionID = EditStepTransition.StepTransitionID; StepTransition.SpecSourceName = StepTransition.DefaultSourceName; if (StepTransitionNameCustomized) { StepTransition.ForwardInstance.StepTransitionName = EditStepTransition.StepTransitionName; } if (FromStepIDCustomized) { StepTransition.ForwardInstance.FromStepID = EditStepTransition.FromStepID; } if (DescriptionCustomized) { StepTransition.ForwardInstance.Description = EditStepTransition.Description; } if (TagsCustomized) { StepTransition.ForwardInstance.Tags = EditStepTransition.Tags; } } EditStepTransition.ResetModified(false); OnUpdated(this, null); // send update back to solution builder SendEditStepTransitionPerformed(); }
///-------------------------------------------------------------------------------- /// <summary>Create the instance with the designer view and other data.</summary> /// /// <param name="stepTransition">The StepTransition to load.</param> /// <param name="solution">The associated solution.</param> /// <param name="loadChildren">Flag indicating if child information should be loaded.</param> ///-------------------------------------------------------------------------------- public StepTransitionViewModel(StepTransition stepTransition, Solution solution, bool loadChildren = true) { WorkspaceID = Guid.NewGuid(); Solution = solution; LoadStepTransition(stepTransition, loadChildren); }