• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ModelElement类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ModelElement的典型用法代码示例。如果您正苦于以下问题:C# ModelElement类的具体用法?C# ModelElement怎么用?C# ModelElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ModelElement类属于命名空间,在下文中一共展示了ModelElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetDependencies

        /// <summary>
        /// Gets the dependencies for a specific model element.
        /// </summary>
        /// <param name="modelElement">Model element to get the dependencies for.</param>
        /// <param name="options">Options.</param>
        /// <returns>List of dependencies.</returns>
        public DependenciesData GetDependencies(ModelElement modelElement, DependenciesRetrivalOptions options)
        {
            List<ModelElement> elements = new List<ModelElement>();
            elements.Add(modelElement);

            return GetDependencies(elements, options);
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:13,代码来源:DependenciesItemsProvider.cs


示例2: Visit

        //TODO: FIXME - This method is a royal mess! 
        public override  bool Visit(ElementWalker walker, ModelElement modelElement)
        {
            var result = base.Visit(walker, modelElement);
            if (walker.InternalElementList.Last() == modelElement)
            {
                var typesNode = this.treeView.Nodes[0].Nodes[0];
                typesNode.Text = "Models";
                foreach (ModelElementTreeNode classNode in typesNode.Nodes)
                {
                    var originalNodes = classNode.Nodes.OfType<RoleGroupTreeNode>().ToArray();
                    foreach (RoleGroupTreeNode roleGroupNode in originalNodes)
                    {
                        var toRemove = new List<ModelElementTreeNode>();
                        foreach (ModelElementTreeNode propNode in roleGroupNode.Nodes)
                        {
                            toRemove.Add(propNode);
                        }

                        foreach (var node in toRemove)
                        {
                            roleGroupNode.Nodes.Remove(node);
                            this.TreeContainer.InsertTreeNode(classNode.Nodes, node);
                        }
                    }
                    foreach (TreeNode node in originalNodes) classNode.Nodes.Remove(node);
                }
                typesNode.Expand();
            }
            return result;
        }
开发者ID:jeswin,项目名称:AgileFx,代码行数:31,代码来源:AgileModelerExplorerElementVisitor.cs


示例3: AddClass

        public static void AddClass(ModelElement cls, CodeTypeDeclaration declaration)
        {
            if (!isInitialized)
                throw new ArgumentException("CodeGenerationContext must first be initialized");
            if (cls == null)
                throw new ArgumentNullException("No class supplied", "cls");
            if (declaration == null)
                throw new ArgumentNullException("No CodeTypeDeclaration supplied", "declaration");

            if (cls.GetType() == typeof(ModelClass))
            {
                ModelClass modelClass = (ModelClass)cls;
                if (!classDeclarations.ContainsKey(modelClass))
                    classDeclarations.Add(modelClass, declaration);
            }
            else if (cls.GetType() == typeof(NestedClass))
            {
                NestedClass nestedClass = (NestedClass)cls;
                if (!nestedClassDeclarations.ContainsKey(nestedClass))
                    nestedClassDeclarations.Add(nestedClass, declaration);
            }
            else
                throw new ArgumentException("Only ModelClass and NestedClass entities supported", "cls");

            generatedClassNames.Add(((NamedElement)cls).Name);
        }
开发者ID:mgagne-atman,项目名称:Projects,代码行数:26,代码来源:CodeGenerationContext.cs


示例4: CanAcceptSourceAndTarget

		public static bool CanAcceptSourceAndTarget(ModelElement candidateSource, ModelElement candidateTarget)
		{
			if(candidateSource == null)
			{
				return false;
			}

			bool acceptSource = CanAcceptSource(candidateSource);
			// If the source wasn't accepted then there's no point checking targets.
			// If there is no target then the source controls the accept.
			if(!acceptSource || candidateTarget == null)
			{
				return acceptSource;
			}
			else // Check combinations
			{
				if(candidateSource is DataContractBase)
				{
                    if (candidateTarget is DataContract) 
					{
						if(HasNullReferences((DataContractBase)candidateSource, (Contract)candidateTarget))
						{
							return false;
						}						
						return true;
					}
				}
			}
			return false;
		}
开发者ID:Phidiax,项目名称:open-wssf-2015,代码行数:30,代码来源:AggregationConnectionBuilder.cs


示例5: UnaryExpression

 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="root">The root for which this expression should be evaluated</param>
 /// <param name="log"></param>
 /// <param name="expression">The enclosed expression</param>
 /// <param name="unaryOp">the unary operator for this unary expression</param>
 /// <param name="start">The start character for this expression in the original string</param>
 /// <param name="end">The end character for this expression in the original string</param>
 public UnaryExpression(ModelElement root, ModelElement log, Expression expression, string unaryOp, int start,
     int end)
     : base(root, log, start, end)
 {
     Expression = SetEnclosed(expression);
     UnaryOp = unaryOp;
 }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:16,代码来源:UnaryExpression.cs


示例6: ExplanationPart

 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="element">The element for which this explanation part is created</param>
 /// <param name="leftPart">The left path to associate to this explanation</param>
 /// <param name="rightPart">The value associate to this left part</param>
 public ExplanationPart(ModelElement element, object leftPart, INamable rightPart = null)
 {
     Element = element;
     LeftPart = leftPart;
     RightPart = rightPart;
     SubExplanations = new List<ExplanationPart>();
 }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:13,代码来源:ExplanationPart.cs


示例7: GetName

        /// <summary>
        /// Gets the element name from the property that is marked as "IsElementName".
        /// </summary>
        /// <param name="modelElement">Domain class to get the name for.</param>
        /// <returns>Name of the domain class as string if found. Null otherwise.</returns>
        public virtual string GetName(ModelElement modelElement)
		{
			if( modelElement is IDomainModelOwnable )
				return (modelElement as IDomainModelOwnable).DomainElementName;
			
			return null;		
		}
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:12,代码来源:ModelElementNameProvider.cs


示例8: HasName

        /// <summary>
        /// Verifies if a given modelElement has a name property or not.
        /// </summary>
        /// <param name="modelElement">ModelElement to verify.</param>
        /// <returns>
        /// True if the given model element has a property marked with "IsElementName" set to true. False otherwise.
        /// </returns>
        public virtual bool HasName(ModelElement modelElement)
		{
			if( modelElement is IDomainModelOwnable )
				return (modelElement as IDomainModelOwnable).DomainElementHasName;

			return false;
		}
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:14,代码来源:ModelElementNameProvider.cs


示例9: CreateDiagramHelper

 internal override EntityDesignerDiagram CreateDiagramHelper(Partition diagramPartition, ModelElement modelRoot)
 {
     var evm = modelRoot as EntityDesignerViewModel;
     var diagram = new EntityDesignerDiagram(diagramPartition);
     diagram.ModelElement = evm;
     return diagram;
 }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:7,代码来源:MicrosoftDataEntityDesignSerializationHelper.cs


示例10: StructExpression

 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="root"></param>
 /// <param name="log"></param>
 /// <param name="structure"></param>
 /// <param name="associations"></param>
 /// <param name="parsingData">Additional information about the parsing process</param>
 public StructExpression(ModelElement root, ModelElement log, Expression structure,
     Dictionary<Designator, Expression> associations, ParsingData parsingData)
     : base(root, log, parsingData)
 {
     Structure = SetEnclosed(structure);
     SetAssociation(associations);
 }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:15,代码来源:StructExpression.cs


示例11: ExpressionBasedListExpression

 /// <summary>
 ///     Constructor for MAP, REDUCE
 /// </summary>
 /// <param name="listExpression"></param>
 /// <param name="condition">the condition to apply to list elements</param>
 /// <param name="iteratorExpression">the expression to be evaluated on each element of the list</param>
 /// <param name="iteratorVariableName"></param>
 /// <param name="start">The start character for this expression in the original string</param>
 /// <param name="end">The end character for this expression in the original string</param>
 public ExpressionBasedListExpression(ModelElement root, ModelElement log, Expression listExpression,
     string iteratorVariableName, Expression condition, Expression iteratorExpression, int start, int end)
     : base(root, log, listExpression, iteratorVariableName, condition, start, end)
 {
     IteratorExpression = iteratorExpression;
     IteratorExpression.Enclosing = this;
 }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:16,代码来源:ExpressionBasedListExpression.cs


示例12: SumExpression

        /// <summary>
        ///     Constructor
        /// </summary>
        /// <param name="log"></param>
        /// <param name="listExpression"></param>
        /// <param name="condition"></param>
        /// <param name="expression"></param>
        /// <param name="root">the root element for which this expression should be parsed</param>
        /// <param name="iteratorVariableName"></param>
        /// <param name="parsingData">Additional information about the parsing process</param>
        public SumExpression(ModelElement root, ModelElement log, Expression listExpression, string iteratorVariableName,
            Expression condition, Expression expression, ParsingData parsingData)
            : base(root, log, listExpression, iteratorVariableName, condition, expression, parsingData)
        {
            AccumulatorVariable = CreateBoundVariable("RESULT", null);
            ISubDeclaratorUtils.AppendNamable(this, AccumulatorVariable);

            if (expression != null)
            {
                DefinedAccumulator = SetEnclosed(expression);
                Accumulator =
                    SetEnclosed(new BinaryExpression(
                        Root,
                        RootLog,
                        DefinedAccumulator,
                        BinaryExpression.Operator.Add,
                        new UnaryExpression(
                            Root,
                            RootLog,
                            new Term(
                                Root,
                                RootLog,
                                new Designator(Root, RootLog, "RESULT", ParsingData.SyntheticElement),
                                ParsingData.SyntheticElement),
                            ParsingData.SyntheticElement),
                        ParsingData.SyntheticElement));
            }
        }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:38,代码来源:SumExpression.cs


示例13: GetElementImage

        /// <summary>
        /// Decides what the icon of the method will be in the interface shape
        /// </summary>
        protected System.Drawing.Image GetElementImage(ModelElement mel)
        {
            var assembly = Assembly.GetExecutingAssembly();

            if (_images.Count == 0)
            {
                _images.Add("field", new System.Drawing.Bitmap(assembly.GetManifestResourceStream(assembly.GetName().Name + ".Resources.field.png")));
                _images.Add("key", new System.Drawing.Bitmap(assembly.GetManifestResourceStream(assembly.GetName().Name + ".Resources.key.png")));
            }

            if (mel is nHydrate.Dsl.ViewField)
            {
                var field = mel as nHydrate.Dsl.ViewField;
                var image = field.CachedImage;
                if (image == null)
                {
                    image = _images["field"];

                    //Primary Key
                    if (field.IsPrimaryKey)
                        image = _images["key"];

                    field.CachedImage = image;
                }
                return image;
            }
            else
            {
                return null;
            }
        }
开发者ID:nHydrate,项目名称:nHydrate,代码行数:34,代码来源:ViewShape.cs


示例14: additionalChecks

        /// <summary>
        /// Perform additional checks based on the parameter types
        /// </summary>
        /// <param name="root">The element on which the errors should be reported</param>
        /// <param name="context">The evaluation context</param>
        /// <param name="actualParameters">The parameters applied to this function call</param>
        public override void additionalChecks(ModelElement root, Interpreter.InterpretationContext context, Dictionary<string, Interpreter.Expression> actualParameters)
        {
            CheckFunctionalParameter(root, context, actualParameters[First.Name], 1);
            CheckFunctionalParameter(root, context, actualParameters[Second.Name], 1);

            Function function1 = actualParameters[First.Name].GetExpressionType() as Function;
            Function function2 = actualParameters[Second.Name].GetExpressionType() as Function;

            if (function1 != null && function2 != null)
            {
                if (function1.FormalParameters.Count == 1 && function2.FormalParameters.Count == 1)
                {
                    Parameter p1 = (Parameter)function1.FormalParameters[0];
                    Parameter p2 = (Parameter)function2.FormalParameters[0];

                    if (p1.Type != p2.Type && p1.Type != EFSSystem.DoubleType && p2.Type != EFSSystem.DoubleType)
                    {
                        root.AddError("The formal parameters for the functions provided as parameter are not the same");
                    }
                }

                if (function1.ReturnType != function2.ReturnType && function1.ReturnType != EFSSystem.DoubleType && function2.ReturnType != EFSSystem.DoubleType)
                {
                    root.AddError("The return values for the functions provided as parameter are not the same");
                }
            }
        }
开发者ID:Assmann-Siemens,项目名称:ERTMSFormalSpecs,代码行数:33,代码来源:Max.cs


示例15: CreateChildShape

		/// <summary>
		/// Customize childshape create to set an initial location for a <see cref="BarkerEntityShape"/>
		/// </summary>
		protected override ShapeElement CreateChildShape(ModelElement element)
		{
			object barkerEntityPositionsObject;
			Dictionary<Guid, PointD> barkerEntityPositions;
			PointD initialLocation;
			BarkerErModelContainsBinaryAssociation modelContainsAssociation;
			EntityType barkerEntity;
			ConceptType conceptType;
			ObjectType objectType;
			if (null != (barkerEntity = element as EntityType))
			{
				if (element.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo.TryGetValue(BarkerEntityPositionDictionaryKey, out barkerEntityPositionsObject) &&
					null != (barkerEntityPositions = barkerEntityPositionsObject as Dictionary<Guid, PointD>) &&
					null != (conceptType = EntityTypeIsPrimarilyForConceptType.GetConceptType(barkerEntity)) &&
					null != (objectType = ConceptTypeIsForObjectType.GetObjectType(conceptType)) &&
					barkerEntityPositions.TryGetValue(objectType.Id, out initialLocation))
				{
					return new BarkerEntityShape(
						this.Partition,
						new PropertyAssignment(BarkerEntityShape.AbsoluteBoundsDomainPropertyId, new RectangleD(initialLocation, new SizeD(1, 0.3))));
				}
			}
			else if (null != (modelContainsAssociation = element as BarkerErModelContainsBinaryAssociation))
			{
				return new AssociationConnector(Partition);
			}
			return base.CreateChildShape(element);
		}
开发者ID:cjheath,项目名称:NORMA,代码行数:31,代码来源:BarkerERDiagram.cs


示例16: CreateChildShape

		/// <summary>
		/// Customize childshape create to set an initial location for a <see cref="TableShape"/>
		/// </summary>
		protected override ShapeElement CreateChildShape(ModelElement element)
		{
			object tablePositionsObject;
			Dictionary<Guid, PointD> tablePositions;
			PointD initialLocation;
			ReferenceConstraintTargetsTable referenceConstraintTargetsTable;
			Table table;
			ConceptType conceptType;
			ObjectType objectType;
			if (null != (table = element as Table))
			{
				if (element.Store.TransactionManager.CurrentTransaction.TopLevelTransaction.Context.ContextInfo.TryGetValue(TablePositionDictionaryKey, out tablePositionsObject) &&
					null != (tablePositions = tablePositionsObject as Dictionary<Guid, PointD>) &&
					null != (conceptType = TableIsPrimarilyForConceptType.GetConceptType(table)) &&
					null != (objectType = ConceptTypeIsForObjectType.GetObjectType(conceptType)) &&
					tablePositions.TryGetValue(objectType.Id, out initialLocation))
				{
					return new TableShape(
						this.Partition,
						new PropertyAssignment(TableShape.AbsoluteBoundsDomainPropertyId, new RectangleD(initialLocation, new SizeD(1, 0.3))));
				}
			}
			else if (null != (referenceConstraintTargetsTable = element as ReferenceConstraintTargetsTable))
			{
				return new ForeignKeyConnector(Partition);
			}
			return base.CreateChildShape(element);
		}
开发者ID:cjheath,项目名称:NORMA,代码行数:31,代码来源:RelationalDiagram.cs


示例17: VariableUpdateStatement

 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="root">The root element for which this element is built</param>
 /// <param name="log"></param>
 /// <param name="variableIdentification"></param>
 /// <param name="expression"></param>
 /// <param name="parsingData">Additional information about the parsing process</param>
 public VariableUpdateStatement(ModelElement root, ModelElement log, Expression variableIdentification,
     Expression expression, ParsingData parsingData)
     : base(root, log, parsingData)
 {
     VariableIdentification = SetEnclosed(variableIdentification);
     Expression = SetEnclosed(expression);
 }
开发者ID:ERTMSSolutions,项目名称:ERTMSFormalSpecs,代码行数:15,代码来源:VariableUpdateStatement.cs


示例18: GetElementText

		protected string GetElementText(ModelElement mel)
		{
			if (mel is nHydrate.Dsl.StoredProcedureField)
			{
				var field = mel as nHydrate.Dsl.StoredProcedureField;
				var model = this.Diagram as nHydrateDiagram;
				var text = field.Name;
				if (model.DisplayType)
					text += " : " + field.DataType.GetSQLDefaultType(field.Length, field.Scale) +
						" " + (field.Nullable ? "Null" : "Not Null");
				return text;
			}
			else if (mel is nHydrate.Dsl.StoredProcedureParameter)
			{
				var parameter = mel as nHydrate.Dsl.StoredProcedureParameter;
				var model = this.Diagram as nHydrateDiagram;
				var text = parameter.Name;
				if (model.DisplayType)
					text += " : " + parameter.DataType.GetSQLDefaultType(parameter.Length, parameter.Scale) +
						" " + (parameter.Nullable ? "Null" : "Not Null");
				return text;
			}
			else
			{
				return string.Empty;
			}
		}
开发者ID:nHydrate,项目名称:nHydrate,代码行数:27,代码来源:StoredProcedureShape.cs


示例19: GetChildren

        /// <summary>
        /// Retrieves all children of a specific parent element. This includes all model elements that are reachable
        /// from the parent element through the embedding relationship.
        /// </summary>
        /// <param name="parentElement">Parent element to retrieve children for.</param>
        /// <param name="bOnlyLocal">Specifies if children of the found children of the given element should be processed too.</param>
        /// <returns>List of model elements that are embedded under the parent element. May be empty.</returns>
        public virtual List<ModelElement> GetChildren(ModelElement parentElement, bool bOnlyLocal)
        {
            List<ModelElement> allChildren = new List<ModelElement>();

            DomainClassInfo info = parentElement.GetDomainClass();
            ReadOnlyCollection<DomainRoleInfo> roleInfoCol = info.AllDomainRolesPlayed;

            foreach (DomainRoleInfo roleInfo in roleInfoCol)
            {
                if (roleInfo.IsSource)
                    if ((parentElement as IDomainModelOwnable).Store.DomainDataAdvDirectory.IsEmbeddingRelationship(roleInfo.DomainRelationship.Id))
                    {
                        global::System.Collections.Generic.IList<ElementLink> links = DomainRoleInfo.GetElementLinks<ElementLink>(parentElement, roleInfo.Id);
                        foreach (ElementLink link in links)
                        {
                            ModelElement child = DomainRoleInfo.GetTargetRolePlayer(link);
                            allChildren.Add(child);

                            if (!bOnlyLocal)
                            {
                                allChildren.AddRange(
                                    (child as IDomainModelOwnable).GetDomainModelServices().ElementChildrenProvider.GetChildren(child, bOnlyLocal));

                            }
                        }
                    }
            }

            return allChildren;
        }
开发者ID:apoorv-vijay-joshi,项目名称:FSE-2011-PDE,代码行数:37,代码来源:ModelElementChildrenProvider.cs


示例20: StructExpression

 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="root"></param>
 /// <param name="log"></param>
 /// <param name="structure"></param>
 /// <param name="associations"></param>
 /// <param name="start">The start character for this expression in the original string</param>
 /// <param name="end">The end character for this expression in the original string</param>
 public StructExpression(ModelElement root, ModelElement log, Expression structure,
     Dictionary<Designator, Expression> associations, int start, int end)
     : base(root, log, start, end)
 {
     Structure = structure;
     SetAssociation(associations);
 }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:16,代码来源:StructExpression.cs



注:本文中的ModelElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ModelHelper类代码示例发布时间:2022-05-24
下一篇:
C# ModelDto类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap