當前位置: 首頁>>代碼示例>>C#>>正文


C# Context.EditingContext類代碼示例

本文整理匯總了C#中Microsoft.Data.Entity.Design.Base.Context.EditingContext的典型用法代碼示例。如果您正苦於以下問題:C# EditingContext類的具體用法?C# EditingContext怎麽用?C# EditingContext使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EditingContext類屬於Microsoft.Data.Entity.Design.Base.Context命名空間,在下文中一共展示了EditingContext類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CreateViewModel

        internal static MappingViewModel CreateViewModel(EditingContext ctx, EFObject selection)
        {
            // clear out the xref so its clean for this new view model
            var xref = ModelToMappingModelXRef.GetModelToMappingModelXRef(ctx);
            xref.Clear();

            // we might be creating a view model for an entity or an association or a FunctionImport
            var entityType = selection as EntityType;
            var association = selection as Association;
            var fim = selection as FunctionImportMapping;

            // create the view model root
            MappingEFElement root = null;
            if (entityType != null)
            {
                root = ModelToMappingModelXRef.GetNewOrExisting(ctx, entityType, null);
            }
            else if (association != null)
            {
                root = ModelToMappingModelXRef.GetNewOrExisting(ctx, association, null);
            }
            else if (fim != null)
            {
                root = ModelToMappingModelXRef.GetNewOrExisting(ctx, fim, null);
            }
            else
            {
                throw new ArgumentException("selection");
            }

            return new MappingViewModel(ctx, root);
        }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:32,代碼來源:MappingViewModelHelper.cs

示例2: RecalculateResults

        internal void RecalculateResults(EditingContext context, ModelSearchResults modelSearchResults)
        {
            // reset all old IsInSearchResults values
            foreach (var oldSearchResult in Results)
            {
                oldSearchResult.IsInSearchResults = false;
            }

            // now recalculate the results based on the new ModelSearchResults
            Reset();
            _targetString = modelSearchResults.TargetString;
            _elementTextToSearch = modelSearchResults.ElementTextToSearch;
            var modelToExplorerModelXRef = ModelToExplorerModelXRef.GetModelToBrowserModelXRef(context);
            if (null != modelToExplorerModelXRef)
            {
                // add all the ExplorerEFElements to _results
                foreach (var result in modelSearchResults.Results)
                {
                    var resultsExplorerElement = modelToExplorerModelXRef.GetExisting(result);
                    if (resultsExplorerElement != null)
                    {
                        resultsExplorerElement.IsInSearchResults = true;
                        _results.Add(resultsExplorerElement);
                    }
                }

                // now sort _results according to the order they appear in the Explorer
                SortResults();
            }
        }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:30,代碼來源:ExplorerSearchResults.cs

示例3: MappingFunctionEntityType

 public MappingFunctionEntityType(EditingContext context, EntityType entityType, MappingEFElement parent)
     : base(context, entityType, parent)
 {
     _insertMapping = new MappingModificationFunctionMapping(context, null, this, ModificationFunctionType.Insert);
     _updateMapping = new MappingModificationFunctionMapping(context, null, this, ModificationFunctionType.Update);
     _deleteMapping = new MappingModificationFunctionMapping(context, null, this, ModificationFunctionType.Delete);
 }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:7,代碼來源:MappingFunctionEntityType.cs

示例4: ExplorerDiagrams

        public ExplorerDiagrams(EditingContext context, Diagrams diagrams, ExplorerEFElement parent)
            : base(context, diagrams, parent)
        {
            var name = Resources.DiagramTypesGhostNodeName;
            base.Name = name;

            _typesGhostNode = new ExplorerTypes(name, context, this);
        }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:8,代碼來源:ExplorerDiagrams.cs

示例5: ExplorerEntityContainerAssociationSets

 public ExplorerEntityContainerAssociationSets(string name, EditingContext context, ExplorerEFElement parent)
     : base(context, null, parent)
 {
     if (name != null)
     {
         base.Name = name;
     }
 }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:8,代碼來源:ExplorerEntityContainerAssociationSets.cs

示例6: MappingAssociation

 public MappingAssociation(EditingContext context, Association assoc, MappingEFElement parent)
     : base(context, assoc, parent)
 {
     Debug.Assert(assoc != null, "MappingAssociation cannot accept a null Association");
     Debug.Assert(
         assoc.AssociationSet != null,
         "MappingAssociation cannot accept an Association " + assoc.ToPrettyString() + " with a null AssociationSet");
 }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:8,代碼來源:MappingAssociation.cs

示例7: ExplorerEnumTypes

 public ExplorerEnumTypes(string name, EditingContext context, ExplorerEFElement parent)
     : base(context, null, parent)
 {
     if (name != null)
     {
         base.Name = name;
     }
 }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:8,代碼來源:ExplorerEnumTypes.cs

示例8: ExplorerProperty

 public ExplorerProperty(EditingContext context, Property property, ExplorerEFElement parent)
     : base(context, property, parent)
 {
     if (null != property)
     {
         _isKeyProperty = property.IsKeyProperty;
     }
 }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:8,代碼來源:ExplorerProperty.cs

示例9: ExplorerFunctionImports

 public ExplorerFunctionImports(string name, EditingContext context, ExplorerEFElement parent)
     : base(context, null, parent)
 {
     if (name != null)
     {
         base.Name = name;
     }
 }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:8,代碼來源:ExplorerFunctionImports.cs

示例10: GetEditingContext

        public static EditingContext GetEditingContext(this EFArtifact artifact)
        {
            Debug.Assert(artifact != null, "artifact != null");

            var service = new EFArtifactService(artifact);
            var editingContext = new EditingContext();
            editingContext.SetEFArtifactService(service);
            return editingContext;
        }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:9,代碼來源:EFArtifactExtensions.cs

示例11: GetArtifactUri

 internal static Uri GetArtifactUri(EditingContext context)
 {
     var item = GetArtifact(context);
     if (item != null)
     {
         return item.Uri;
     }
     return null;
 }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:9,代碼來源:EditingContextManager.cs

示例12: CreateViewModel

        public override void CreateViewModel(EditingContext ctx)
        {
            var service = ctx.GetEFArtifactService();
            Debug.Assert(service != null, "Null service in ExplorerViewModelHelper.CreateViewModel()");
            var artifact = service.Artifact;
            Debug.Assert(artifact != null, "Null artifact in ExplorerViewModelHelper.CreateViewModel()");

            var xref = ModelToExplorerModelXRef.GetModelToBrowserModelXRef(ctx);
            xref.Clear();

            var edmRootNode = new ExplorerRootNode(ctx, null, artifact.Uri);

            var designerInfo = artifact.DesignerInfo();
            if (designerInfo != null
                && designerInfo.Diagrams != null)
            {
                var explorerDiagrams = (ExplorerDiagrams)
                                       ModelToExplorerModelXRef.GetNewOrExisting(
                                           ctx, designerInfo.Diagrams, edmRootNode, typeof(ExplorerDiagrams));
                edmRootNode.Diagrams = explorerDiagrams;
            }

            if (artifact.ConceptualModel() != null)
            {
                var browserCsdlEntityModel = (ExplorerConceptualEntityModel)
                                             ModelToExplorerModelXRef.GetNewOrExisting(
                                                 ctx, artifact.ConceptualModel(), edmRootNode, typeof(ExplorerConceptualEntityModel));
                edmRootNode.ConceptualModel = browserCsdlEntityModel;
            }

            if (artifact.StorageModel() != null)
            {
                var browserSsdlEntityModel = (ExplorerStorageEntityModel)
                                             ModelToExplorerModelXRef.GetNewOrExisting(
                                                 ctx, artifact.StorageModel(), edmRootNode, typeof(ExplorerStorageEntityModel));
                edmRootNode.StorageModel = browserSsdlEntityModel;
            }

            // expand the tree view so that the Conceptual, Storage Models, and Diagram nodes are visible
            if (edmRootNode.Diagrams != null)
            {
                edmRootNode.Diagrams.Types.ExpandTreeViewToMe();
            }

            if (edmRootNode.ConceptualModel != null)
            {
                edmRootNode.ConceptualModel.Types.ExpandTreeViewToMe();
            }

            if (edmRootNode.StorageModel != null)
            {
                edmRootNode.StorageModel.Types.ExpandTreeViewToMe();
            }

            base.ViewModel = new ExplorerViewModel(ctx, edmRootNode);
        }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:56,代碼來源:EntityDesignExplorerViewModelHelper.cs

示例13: MappingModificationFunctionMapping

 public MappingModificationFunctionMapping(EditingContext context, ModificationFunction functionMapping, MappingEFElement parent)
     : base(context, functionMapping, parent)
 {
     if (functionMapping != null)
     {
         _functionType = functionMapping.FunctionType;
         _properties = new MappingFunctionScalarProperties(context, functionMapping, this);
         _resultBindings = new MappingResultBindings(context, functionMapping, this);
     }
 }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:10,代碼來源:MappingModificationFunctionMapping.cs

示例14: ExplorerTypes

        public ExplorerTypes(string name, EditingContext context, ExplorerEFElement parent)
            : base(context, null, parent)
        {
            if (name != null)
            {
                base.Name = name;
            }

            _isConceptual = (typeof(ExplorerConceptualEntityModel) == parent.GetType()) ? true : false;
        }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:10,代碼來源:ExplorerTypes.cs

示例15: ExplorerStorageEntityModel

 public ExplorerStorageEntityModel(EditingContext context, StorageEntityModel entityModel, ExplorerEFElement parent)
     : base(context, entityModel, parent)
 {
     _typesGhostNode = new ExplorerTypes(
         Resources.StorageTypesGhostNodeName, context, this);
     _funcsGhostNode = new ExplorerFunctions(
         Resources.StorageFunctionsGhostNodeName, context, this);
     _assocsGhostNode = new ExplorerAssociations(
         Resources.StorageAssociationsGhostNodeName, context, this);
 }
開發者ID:Cireson,項目名稱:EntityFramework6,代碼行數:10,代碼來源:ExplorerStorageEntityModel.cs


注:本文中的Microsoft.Data.Entity.Design.Base.Context.EditingContext類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。