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

C# Commands.CommandProcessorContext类代码示例

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

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



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

示例1: InvokeInternal

        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            Debug.Assert(_properties != null && _properties.Count > 0, "There is no property to be moved.");
            if (_properties != null
                && _properties.Count > 0)
            {
                Debug.Assert(_step > 0, "Parameter step value is not valid. The value must be greater than 0.");
                if (_step > 0)
                {
                    // Properties are moved in the following order:
                    // - If the properties are moved forward (MoveDirection == Down), we need to move the property that are closer to the last-property first.
                    // - If the properties are moved backward (MoveDirection == Up), we need to move the property that are closer to the first-property first.
                    var sortedProperties = ModelHelper.GetListOfPropertiesInTheirXElementsOrder(_properties);
                    Debug.Assert(
                        sortedProperties.Count == _properties.Count, "The sorted properties should have the same number of properties.");

                    PropertyBase previouslyMovedProperty = null;
                    foreach (var property in (_moveDirection == MoveDirection.Up ? sortedProperties : sortedProperties.Reverse()))
                    {
                        // Ensure that properties are moved don't change order.
                        // For example: if property A, B and C are moved forward, the move should not cause property A to be placed after Property B.
                        var numberOfSteps = GetNumberOfMoveStep(property, previouslyMovedProperty);

                        if (numberOfSteps > 0)
                        {
                            CommandProcessor.InvokeSingleCommand(cpc, new MovePropertyCommand(property, _moveDirection, numberOfSteps));
                        }
                        previouslyMovedProperty = property;
                    }
                }
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:32,代码来源:MovePropertiesCommand.cs


示例2: PreInvoke

        protected override void PreInvoke(CommandProcessorContext cpc)
        {
            // Save off the deleted function mport name
            DeletedFunctionImportName = FunctionImport.Name.Value;

            base.PreInvoke(cpc);
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:7,代码来源:DeleteFunctionImportCommand.cs


示例3: InvokeInternal

        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            Debug.Assert(cpc != null, "InvokeInternal is called when EntityContainerMapping is null.");

            // safety check, this should never be hit
            if (EntityType == null)
            {
                throw new InvalidOperationException("InvokeInternal is called when entity type is null");
            }

            EntityType.Abstract.Value = SetAbstract;

            // remove any function mappings if we are setting this to abstract
            if (SetAbstract)
            {
                var etms = new List<EntityTypeMapping>();
                etms.AddRange(EntityType.GetAntiDependenciesOfType<EntityTypeMapping>());

                for (var i = etms.Count - 1; i >= 0; i--)
                {
                    var etm = etms[i];
                    if (etm != null
                        && etm.Kind == EntityTypeMappingKind.Function)
                    {
                        DeleteEFElementCommand.DeleteInTransaction(cpc, etm);
                    }
                }
            }

            XmlModelHelper.NormalizeAndResolve(EntityType);
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:31,代码来源:ChangeEntityTypeAbstractCommand.cs


示例4: ScheduleChildAntiDependenciesForRebinding

 internal static void ScheduleChildAntiDependenciesForRebinding(CommandProcessorContext cpc, EFObject efObject)
 {
     // identify any binding that was referencing this symbol, and add it to the list of things to rebind.
     var visitor = new AntiDependencyCollectorVisitor();
     visitor.Traverse(efObject);
     ScheduleBindingsForRebind(cpc, visitor.AntiDependencyBindings);
 }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:7,代码来源:CheckArtifactBindings.cs


示例5: InvokeInternal

        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            if (_entityProperty != null)
            {
                Debug.Assert(_entityProperty.EntityModel.IsCSDL, "_entityProperty should be from C-side model");
                ScalarProperty.Name.SetRefName(_entityProperty);
            }

            if (TableColumn != null)
            {
                Debug.Assert(TableColumn.EntityModel.IsCSDL != true, "_tableColumn should not be from C-side model");
                ScalarProperty.ColumnName.SetRefName(TableColumn);
            }

            XmlModelHelper.NormalizeAndResolve(ScalarProperty);

            // if we change a scalar in an association mapping, make sure that we still have good MSL
            if (ScalarProperty.EndProperty != null)
            {
                var asm = ScalarProperty.EndProperty.Parent as AssociationSetMapping;
                Debug.Assert(asm != null, "_sp.EndProperty parent is not an AssociationSetMapping");
                if (asm != null)
                {
                    EnforceAssociationSetMappingRules.AddRule(cpc, asm);

                    var assoc = asm.TypeName.Target;
                    Debug.Assert(assoc != null, "Could not resolve association reference");
                    if (assoc != null)
                    {
                        InferReferentialConstraints.AddRule(cpc, assoc);
                    }
                }
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:34,代码来源:ChangeScalarPropertyCommand.cs


示例6: PropagateStoreGeneratedPatternToStorageModel

 internal PropagateStoreGeneratedPatternToStorageModel(
     CommandProcessorContext cpc, StorageProperty storageProperty, bool propagateNoneSGP)
 {
     _cpc = cpc;
     _storageProperty = storageProperty;
     _propagateNoneSGP = propagateNoneSGP;
 }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:7,代码来源:PropagateStoreGeneratedPatternToStorageModel.cs


示例7: InvokeInternal

        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            var cmd = new UpdateDefaultableValueCommand<string>(_typeAccess, _newValue);
            CommandProcessor.InvokeSingleCommand(cpc, cmd);

            if (ModelConstants.CodeGenerationAccessInternal.Equals(_newValue, StringComparison.Ordinal))
            {
                var cet = _typeAccess.GetParentOfType(typeof(ConceptualEntityType)) as ConceptualEntityType;
                Debug.Assert(null != cet, "parent of _typeAccess should be of type " + typeof(ConceptualEntityType).FullName);
                if (null != cet)
                {
                    // Note: it is valid for the EntitySet to be null
                    var ces = cet.EntitySet as ConceptualEntitySet;
                    if (null != ces)
                    {
                        var entitySetGetterAccess = ces.GetterAccess.Value;
                        if (ModelConstants.CodeGenerationAccessPublic.Equals(entitySetGetterAccess)
                            || ModelConstants.CodeGenerationAccessProtected.Equals(entitySetGetterAccess))
                        {
                            // new value is Internal and EntitySet's existing value is Public or Protected
                            // so need to also update the GetterAccess attribute on the EntitySet
                            // (otherwise will get runtime error 6036)
                            var cmd2 = new UpdateDefaultableValueCommand<string>(ces.GetterAccess, _newValue);
                            CommandProcessor.InvokeSingleCommand(cpc, cmd2);
                        }
                    }
                }
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:29,代码来源:UpdateEntityTypeTypeAccessCommand.cs


示例8: InvokeInternal

        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            if (!string.IsNullOrEmpty(Role)
                && !string.Equals(End.Role.Value, Role, StringComparison.Ordinal))
            {
                // TODO:  should this command be enqueued in the command processor?
                RenameCommand c = new EntityDesignRenameCommand(End, Role, true);
                CommandProcessor.InvokeSingleCommand(cpc, c);

                // bug 563525: we need to update EndProperties within AssociationSetMappings if the AssociationEnd changes.
                // we update the "Role" of an AssociationSetEnd in the RenameCommand but the SingleItemBinding that we have to update
                // that is bound to the AssociationSetEnd is unique to this situation; it is not technically a "refactor rename".
                var associationSetEnd = End.GetAntiDependenciesOfType<AssociationSetEnd>().FirstOrDefault();

                if (associationSetEnd != null)
                {
                    // we need to renormalize the associationSetEnd, since the role name will have changed.
                    XmlModelHelper.NormalizeAndResolve(associationSetEnd);

                    var endPropertiesInAssocSetMappings = associationSetEnd.GetAntiDependenciesOfType<EndProperty>();
                    foreach (var endProperty in endPropertiesInAssocSetMappings)
                    {
                        endProperty.Name.SetRefName(associationSetEnd);
                        CheckArtifactBindings.ScheduleBindingsForRebind(cpc, new HashSet<ItemBinding> { endProperty.Name });
                    }
                }
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:28,代码来源:ChangeAssociationEndCommand.cs


示例9: InvokeInternal

        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            if (_diagram != null)
            {
                // Add diagram id information in the transaction context.
                // This is to ensure the diagram objects are created correctly.
                if (cpc.EfiTransaction.GetContextValue<DiagramContextItem>(EfiTransactionOriginator.TransactionOriginatorDiagramId) == null)
                {
                    cpc.EfiTransaction.AddContextValue(
                        EfiTransactionOriginator.TransactionOriginatorDiagramId, new DiagramContextItem(_diagram.Id.Value));
                }
            }

            var service = cpc.EditingContext.GetEFArtifactService();
            var artifact = service.Artifact;

            // check if entity is in the model
            _createdEntity = artifact.ArtifactSet.LookupSymbol(_clipboardEntity.NormalizedName) as EntityType;
            if (_diagram != null
                && _createdEntity != null
                && _createdEntity is ConceptualEntityType)
            {
                if (_createdEntity.GetAntiDependenciesOfType<EntityTypeShape>().Count(ets => ets.Diagram.Id == _diagram.Id.Value) == 0)
                {
                    // CreateEntityTypeShapeAndConnectorsInDiagram method will check if the shape for the entity-type has been created; 
                    // and it will not create one if the shape already exists in the diagram.
                    // Also, VerifyDiagramModelIntegrityVisitor will assert if there are duplicate diagram shapes (shapes that point to the same model element)
                    // every-time a command transaction is committed. So adding another check to do the same thing here is redundant.
                    CreateEntityTypeShapeCommand.CreateEntityTypeShapeAndConnectorsInDiagram(
                        cpc, _diagram, _createdEntity as ConceptualEntityType, _clipboardEntity.EntityTypeShapeFillColor, false);
                    return;
                }
            }
            CreateEntityCopyInModel(cpc);
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:35,代码来源:copyentitycommand.cs


示例10: InvokeInternal

        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            // if don't have an ECM yet, go create one
            if (_entityContainerMapping == null)
            {
                var cmd = new CreateEntityContainerMappingCommand(_entitySet.Artifact);
                CommandProcessor.InvokeSingleCommand(cpc, cmd);

                _entityContainerMapping = cmd.EntityContainerMapping;
            }

            Debug.Assert(_entityContainerMapping != null, "_entityContainerMapping should not be null");
            if (_entityContainerMapping == null)
            {
                throw new CannotLocateParentItemException();
            }

            // create the ESM
            var esm = new EntitySetMapping(_entityContainerMapping, null);
            esm.Name.SetRefName(_entitySet);
            _entityContainerMapping.AddEntitySetMapping(esm);

            XmlModelHelper.NormalizeAndResolve(esm);

            _created = esm;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:26,代码来源:CreateEntitySetMappingCommand.cs


示例11: InvokeInternal

        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            var associationSetMapping = ModelHelper.FindAssociationSetMappingForConceptualAssociation(Association);

            if (associationSetMapping == null)
            {
                // This AssociationSetMapping does not exist, create it
                base.InvokeInternal(cpc);
                associationSetMapping = AssociationSetMapping;
                Debug.Assert(associationSetMapping != null, "Could not create AssociationSetMapping");
            }
            else
            {
                // The AssociationSetMapping already exists, update it
                associationSetMapping.Name.SetRefName(AssociationSet);
                associationSetMapping.TypeName.SetRefName(Association);
                associationSetMapping.StoreEntitySet.SetRefName(StorageEntitySet);

                XmlModelHelper.NormalizeAndResolve(associationSetMapping);

                Debug.Assert(associationSetMapping.Name.Target != null, "Could not resolve association set reference");
                Debug.Assert(associationSetMapping.TypeName.Target != null, "Could not resolve association type reference");
                Debug.Assert(associationSetMapping.StoreEntitySet.Target != null, "Could not resolve table reference");

                InferReferentialConstraints.AddRule(cpc, Association);
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:27,代码来源:CreateOrUpdateAssociationSetMappingCommand.cs


示例12: InvokeInternal

        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            // safety check, this should never be hit
            Debug.Assert(Property != null, "InvokeInternal is called when Property is null.");
            if (Property == null)
            {
                throw new InvalidOperationException("InvokeInternal is called when Property is null.");
            }

            var cmd = new UpdateDefaultableValueCommand<string>(Property.StoreGeneratedPattern, SgpValue);
            CommandProcessor.InvokeSingleCommand(cpc, cmd);

            // ensure view keys are propagated from C-side to S-side
            var cet = Property.EntityType as ConceptualEntityType;
            if (cet != null)
            {
                PropagateViewKeysToStorageModel.AddRule(cpc, cet);
            }

            // ensure StoreGeneratedPattern is propagated from C-side to S-side
            // unless we are part of an Update Model txn in which case there is no need
            // as the whole artifact has this integrity check applied by UpdateModelFromDatabaseCommand
            if (EfiTransactionOriginator.UpdateModelFromDatabaseId != cpc.OriginatorId)
            {
                var cProp = Property as ConceptualProperty;
                Debug.Assert(cProp != null, "expected Property of type ConceptualProperty, instead got type " + Property.GetType().FullName);
                if (cProp != null)
                {
                    PropagateStoreGeneratedPatternToStorageModel.AddRule(cpc, cProp, true);
                }
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:32,代码来源:SetStoreGeneratedPatternCommand.cs


示例13: StaticInvoke

        internal static void StaticInvoke(CommandProcessorContext cpc, InheritanceConnector inheritanceConnector)
        {
            // if there was a circular inheritance, this connector will be deleted, if so, we just return
            if (inheritanceConnector.IsDeleted)
            {
                return;
            }

            var viewModel = inheritanceConnector.GetRootViewModel();
            Debug.Assert(
                viewModel != null, "Unable to find root view model from inheritance connector: " + inheritanceConnector.AccessibleName);

            if (viewModel != null)
            {
                var modelEntityTypeBase = viewModel.ModelXRef.GetExisting(inheritanceConnector.ModelElement) as EntityTypeBaseType;
                if (modelEntityTypeBase != null)
                {
                    var modelEntity = modelEntityTypeBase.Parent as EntityType;
                    var modelDiagram = viewModel.ModelXRef.GetExisting(inheritanceConnector.Diagram) as Diagram;
                    Debug.Assert(modelEntity != null && modelDiagram != null);
                    if (modelEntity != null
                        && modelDiagram != null)
                    {
                        var cmd = new CreateInheritanceConnectorCommand(modelDiagram, modelEntity);
                        CommandProcessor.InvokeSingleCommand(cpc, cmd);
                        var modelInheritanceConnector = cmd.InheritanceConnector;
                        viewModel.ModelXRef.Add(modelInheritanceConnector, inheritanceConnector, viewModel.EditingContext);
                    }
                }
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:31,代码来源:InheritanceConnectorAdd.cs


示例14: Invoke

        internal override void Invoke(CommandProcessorContext cpc)
        {
            var viewModel = _inheritance.GetRootViewModel();
            Debug.Assert(viewModel != null, "Unable to find root view model from inheritance: " + _inheritance);

            if (viewModel != null)
            {
                if (ViewUtils.SetBaseEntityType(cpc, _derivedEntity, _baseEntity))
                {
                    viewModel.ModelXRef.Add(_derivedEntity.BaseType, _inheritance, viewModel.EditingContext);
                }
                else
                {
                    try
                    {
                        // setting null will clear out the selection, which may be this Inheritance thing we are deleting
                        viewModel.GetDiagram().ActiveDiagramView.Selection.Set((DiagramItem)null);

                        // in this case inheritance was not created in the model, so we need to delete it from the view model
                        // we don't want any rules to fire for this, so suspend them temporarly
                        _inheritance.Store.RuleManager.SuspendRuleNotification();
                        using (var t = _inheritance.Store.TransactionManager.BeginTransaction())
                        {
                            _inheritance.Delete();
                            t.Commit();
                        }
                    }
                    finally
                    {
                        _inheritance.Store.RuleManager.ResumeRuleNotification();
                    }
                }
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:34,代码来源:InheritanceAdd.cs


示例15: InvokeInternal

        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            // check that we have an existing artifact
            var service = cpc.EditingContext.GetEFArtifactService();
            var existingArtifact = service.Artifact as EntityDesignArtifact;
            if (null == existingArtifact)
            {
                Debug.Fail("Null Artifact in ReplaceSsdlCommand.InvokeInternal()");
                return;
            }

            // replace the old SSDL with the new
            ReplaceSsdl(cpc, existingArtifact, _newSsdlReader);

            // replace the old MSL with the new
            ReplaceMsl(cpc, existingArtifact, _newMslReader);

            // normalize and resolve the StorageModel
            XmlModelHelper.NormalizeAndResolve(existingArtifact.StorageModel);
            Debug.Assert(EFElementState.Resolved == existingArtifact.StorageModel.State, "StorageModel State should be Resolved");

            // normalize and resolve the MappingModel
            XmlModelHelper.NormalizeAndResolve(existingArtifact.MappingModel);
            Debug.Assert(EFElementState.Resolved == existingArtifact.MappingModel.State, "MappingModel State should be Resolved");
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:25,代码来源:ReplaceSsdlAndMslCommand.cs


示例16: InvokeInternal

        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            if (String.IsNullOrEmpty(_summaryText))
            {
                if (_efElement.Documentation != null
                    && _efElement.Documentation.Summary != null)
                {
                    DeleteEFElementCommand.DeleteInTransaction(cpc, _efElement.Documentation.Summary);

                    // if the documentation node is empty, delete it
                    if (_efElement.Documentation.LongDescription == null)
                    {
                        DeleteEFElementCommand.DeleteInTransaction(cpc, _efElement.Documentation);
                    }
                }
            }
            else
            {
                if (_efElement.Documentation == null)
                {
                    _efElement.Documentation = new Documentation(_efElement, null);
                }

                if (_efElement.Documentation.Summary == null)
                {
                    _efElement.Documentation.Summary = new Summary(_efElement.Documentation, null);
                }

                _efElement.Documentation.Summary.Text = _summaryText;

                XmlModelHelper.NormalizeAndResolve(_efElement);
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:33,代码来源:SetDocumentationSummaryCommand.cs


示例17: InvokeInternal

        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            // if the DesignerInfoPropertySet doesn't exist then we need to create it.
            if (_designerInfo.PropertySet == null)
            {
                _designerInfo.PropertySet = new DesignerInfoPropertySet(_designerInfo, null);
            }

            // if the DesignerProperty doesn't exist then we need to create it.
            DesignerProperty designerProperty;
            if (!_designerInfo.PropertySet.TryGetDesignerProperty(_name, out designerProperty))
            {
                designerProperty = new DesignerProperty(_designerInfo.PropertySet, null);
                designerProperty.LocalName.Value = _name;
                _designerInfo.PropertySet.AddDesignerProperty(_name, designerProperty);
            }

            // First let's check make sure any non-valid values are caught up the stack
            if (!designerProperty.ValueAttr.IsValidValue(_value))
            {
                throw new CommandValidationFailedException(
                    String.Format(CultureInfo.CurrentCulture, Resources.NonValidDesignerProperty, _value, _name));
            }

            // now we update the value of the designer property
            var cmdUpdateDefaultableValue = new UpdateDefaultableValueCommand<string>(designerProperty.ValueAttr, _value);
            CommandProcessor.InvokeSingleCommand(cpc, cmdUpdateDefaultableValue);

            // normalize and resolve the entire DesignerInfo
            XmlModelHelper.NormalizeAndResolve(_designerInfo);
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:31,代码来源:ChangeDesignerPropertyCommand.cs


示例18: Invoke

        internal override void Invoke(CommandProcessorContext cpc)
        {
            var viewModel = _property.GetRootViewModel();
            Debug.Assert(viewModel != null, "Unable to find root view model from property: " + _property.Name);

            if (viewModel != null)
            {
                var entityType = viewModel.ModelXRef.GetExisting(_property.EntityType) as Model.Entity.EntityType;
                Debug.Assert(entityType != null);
                Model.Entity.Property property = null;
                if (_property is ScalarProperty)
                {
                    property = CreatePropertyCommand.CreateDefaultProperty(cpc, _property.Name, entityType);
                    var scalarProperty = _property as ScalarProperty;
                    if (scalarProperty != null
                        && scalarProperty.EntityKey)
                    {
                        CommandProcessor.InvokeSingleCommand(cpc, new SetKeyPropertyCommand(property, true));
                    }
                }
                else
                {
                    property = CreateComplexPropertyCommand.CreateDefaultProperty(cpc, _property.Name, entityType);
                }
                viewModel.ModelXRef.Add(property, _property, viewModel.EditingContext);
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:27,代码来源:PropertyAdd.cs


示例19: InvokeInternal

 protected override void InvokeInternal(CommandProcessorContext cpc)
 {
     var fae = FunctionScalarProperty.AssociationEnd;
     var fcp = FunctionScalarProperty.FunctionComplexProperty;
     if (fae != null
         && fae.ScalarProperties().Count == 1)
     {
         // we are the last one, so remove the entire AssociationEnd
         DeleteInTransaction(cpc, FunctionScalarProperty.AssociationEnd);
     }
     else if (fcp != null
              && fcp.ScalarProperties().Count == 1
              && fcp.ComplexProperties().Count == 0)
     {
         //  we are about to remove the last item from this FunctionComplexProperty, so remove the entire FunctionComplexProperty
         Debug.Assert(
             fcp.ScalarProperties()[0] == FunctionScalarProperty,
             "fcp.ScalarProperties()[0] should be the same as this.FunctionScalarProperty");
         DeleteInTransaction(cpc, fcp);
     }
     else
     {
         // all other cases, just remove the ScalarProperty
         base.InvokeInternal(cpc);
     }
 }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:26,代码来源:DeleteFunctionScalarPropertyCommand.cs


示例20: InvokeInternal

        protected override void InvokeInternal(CommandProcessorContext cpc)
        {
            var nExistingTypeShapeCount =
                _entity.GetAntiDependenciesOfType<EntityTypeShape>().Count(ets => ets.Diagram.Id == _diagram.Id.Value);

            Debug.Assert(
                nExistingTypeShapeCount == 0,
                "There is already Entity Type Shape for entity :" + _entity.Name + " in the diagram " + _diagram.Name);

            if (nExistingTypeShapeCount == 0)
            {
                var shape = new EntityTypeShape(_diagram, null);
                _diagram.AddEntityTypeShape(shape);

                shape.EntityType.SetRefName(_entity);
                shape.Width.Value = DEFAULTWIDTH;

                // The DSL will set the correct locations for the shapes at a later point, but we need to provide initial values for X and Y in the meantime
                // so that we can construct the shape. We're using random numbers here to ensure that if the DSL fails for some reason, new shapes do not
                // stack directly on top of each other.
                shape.PointX.Value = _rand.NextDouble() * 12.0;
                shape.PointY.Value = _rand.NextDouble() * 32.0;

                if (_fillColor != EntityDesignerDiagramConstant.EntityTypeShapeDefaultFillColor)
                {
                    shape.FillColor.Value = _fillColor;
                }

                XmlModelHelper.NormalizeAndResolve(shape);

                _created = shape;
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:33,代码来源:CreateEntityTypeShapeCommand.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Metadata.Model类代码示例发布时间:2022-05-26
下一篇:
C# Context.EditingContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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