本文整理汇总了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);
}
示例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();
}
}
示例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);
}
示例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);
}
示例5: ExplorerEntityContainerAssociationSets
public ExplorerEntityContainerAssociationSets(string name, EditingContext context, ExplorerEFElement parent)
: base(context, null, parent)
{
if (name != null)
{
base.Name = name;
}
}
示例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");
}
示例7: ExplorerEnumTypes
public ExplorerEnumTypes(string name, EditingContext context, ExplorerEFElement parent)
: base(context, null, parent)
{
if (name != null)
{
base.Name = name;
}
}
示例8: ExplorerProperty
public ExplorerProperty(EditingContext context, Property property, ExplorerEFElement parent)
: base(context, property, parent)
{
if (null != property)
{
_isKeyProperty = property.IsKeyProperty;
}
}
示例9: ExplorerFunctionImports
public ExplorerFunctionImports(string name, EditingContext context, ExplorerEFElement parent)
: base(context, null, parent)
{
if (name != null)
{
base.Name = name;
}
}
示例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;
}
示例11: GetArtifactUri
internal static Uri GetArtifactUri(EditingContext context)
{
var item = GetArtifact(context);
if (item != null)
{
return item.Uri;
}
return null;
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}