///--------------------------------------------------------------------------------
        /// <summary>Show a trace message 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="messageBody">The main body message to show.</param>
        /// <param name="showMessageBox">Flag indicating whether message box should be displayed in addition to output area.</param>
        ///--------------------------------------------------------------------------------
        public string ShowTraceMessage(Solution solutionContext, ITemplate templateContext, IDomainEnterpriseObject modelContext, string messageBody, bool showMessageBox = false)
        {
            StringBuilder message = new StringBuilder();

            message.Append(messageBody);
            message.Append(", ");
            message.Append(DisplayValues.Exception_SolutionIntro);
            message.Append(" ");
            message.Append(solutionContext.SolutionName);
            message.Append(", ");
            message.Append(DisplayValues.Exception_NodeIntro);
            message.Append(" ");
            message.Append(templateContext.NodeName);
            message.Append(", ");
            message.Append(DisplayValues.Exception_TemplateIntro);
            message.Append(" ");
            message.Append(templateContext.TemplateName);
            message.Append(", ");
            message.Append(DisplayValues.Exception_LineNumberIntro);
            message.Append(" ");
            message.Append(LineNumber.ToString());
            message.Append(", ");
            message.Append(DisplayValues.Exception_ModelContextIntro);
            message.Append(" ");
            message.Append(modelContext.GetType().Name);
            message.Append(", ");
            message.Append(DisplayValues.Exception_ModelIdIntro);
            message.Append(" ");
            message.Append(modelContext.ID.ToString());
            solutionContext.ShowOutput(message.ToString(), null, true, showMessageBox);
            return(message.ToString());
        }
Пример #2
0
        ///--------------------------------------------------------------------------------
        /// <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);
        }
Пример #3
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method gets the content for a watch expression.</summary>
        ///
        /// <param name="watchExpression">Expression to evaluate.</param>
        /// <param name="parentModelContext">The parent model context from which to generate code.</param>
        ///
        /// <returns>A string representing the generated code for the watch expression.</returns>
        ///--------------------------------------------------------------------------------
        public string GetWatchContent(string watchExpression, IDomainEnterpriseObject parentModelContext)
        {
            try
            {
                SpecTemplate template = Solution.SpecTemplates[TemplateKey] as SpecTemplate;
                if (template == null)
                {
                    return(String.Empty);
                }

                // handle special cases
                if (String.IsNullOrEmpty(watchExpression))
                {
                    return(String.Empty);
                }
                if (watchExpression == LanguageTerms.TextProperty)
                {
                    return(template.ContentCodeBuilder.ToString());
                }
                if (watchExpression == LanguageTerms.PathProperty)
                {
                    return(template.OutputCodeBuilder.ToString());
                }

                // create temporary template
                SpecTemplate watchTemplate = new SpecTemplate();
                watchTemplate.Solution        = Solution;
                watchTemplate.NodeName        = parentModelContext.GetType().Name;
                watchTemplate.IsWatchTemplate = true;

                // wrap input expression into a template with a single property
                watchTemplate.TemplateContent = LanguageTerms.PropOpenTag + watchExpression + LanguageTerms.CloseTag;

                // push parameters and variables onto watch template
                if (template != null)
                {
                    foreach (string key in template.Parameters.AllKeys)
                    {
                        watchTemplate.Parameters[key] = template.Parameters[key];
                    }
                    foreach (string key in template.Variables.AllKeys)
                    {
                        watchTemplate.Variables[key] = template.Variables[key];
                    }
                }

                // push template context stack onto watch template as needed
                if (template != null && template.ModelContextStack.Count > 1)
                {
                    for (int i = template.ModelContextStack.Count - 1; i > 0; i--)
                    {
                        watchTemplate.PushModelContext(template.ModelContextStack[i]);
                    }
                }

                // get expression value
                string watchValue = watchTemplate.GetContent(parentModelContext);
                if (watchTemplate.HasErrors == true)
                {
                    watchValue = DisplayValues.Exception_WatchExpression;
                }
                return(watchValue);
            }
            catch (ApplicationAbortException ex)
            {
                return(ex.Message);
            }
            catch (System.Exception ex)
            {
                return(ex.Message);
            }
        }
Пример #4
0
        ///--------------------------------------------------------------------------------
        /// <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);
        }