本文整理汇总了C#中Microsoft.Data.Entity.Design.Base.Context.EditingContext.GetEFArtifactService方法的典型用法代码示例。如果您正苦于以下问题:C# EditingContext.GetEFArtifactService方法的具体用法?C# EditingContext.GetEFArtifactService怎么用?C# EditingContext.GetEFArtifactService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Data.Entity.Design.Base.Context.EditingContext
的用法示例。
在下文中一共展示了EditingContext.GetEFArtifactService方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: GetArtifact
internal static EFArtifact GetArtifact(EditingContext context)
{
if (context != null)
{
var service = context.GetEFArtifactService();
if (service != null)
{
return service.Artifact;
}
}
return null;
}
示例3: PropertyExtensionContextImpl
internal PropertyExtensionContextImpl(
EditingContext editingContext, ProjectItem projectItem, Version targetSchemaVersion, byte[] extensionToken)
{
Debug.Assert(editingContext != null, "editingContext should not be null");
Debug.Assert(editingContext.GetEFArtifactService().Artifact != null, "editingContext should not have null artifact");
Debug.Assert(projectItem != null, "projectItem should not be null");
Debug.Assert(extensionToken != null, "extensionToken should not be null");
_editingContext = editingContext;
_projectItem = projectItem;
_targetSchemaVersion = targetSchemaVersion;
_extensionToken = extensionToken;
}
示例4: GetModelToBrowserModelXRef
internal static ModelToExplorerModelXRef GetModelToBrowserModelXRef(EditingContext context)
{
Type modelToExplorerModelXRefType;
if (
!_modelManagerType2XRefType.TryGetValue(
context.GetEFArtifactService().Artifact.ModelManager.GetType(), out modelToExplorerModelXRefType))
{
Debug.Fail(
"Could not find a ModelToExplorerModelXRef type for the ModelManager of type '"
+ context.GetEFArtifactService().Artifact.ModelManager.GetType()
+ "'. Make sure to call AddModelManager2XRefType before calling GetModelToBrowserModelXRef.");
return null;
}
// Update EFElement to BrowserEFElement cross reference so that Search Results can later access it
var xref = (ModelToExplorerModelXRef)context.Items.GetValue(modelToExplorerModelXRefType);
if (xref == null)
{
xref = (ModelToExplorerModelXRef)Activator.CreateInstance(modelToExplorerModelXRefType);
context.Items.SetValue(xref);
}
return xref;
}
示例5: GetCurrentArtifactsInView
/// <summary>
/// Returns the current active artifacts.
/// Assumption in here is that a view can span multiple artifacts..
/// </summary>
/// <param name="context"></param>
/// <returns></returns>
protected virtual HashSet<EFArtifact> GetCurrentArtifactsInView(EditingContext context)
{
var serviceFromContext = context.GetEFArtifactService();
Debug.Assert(
serviceFromContext != null, "Null service in EditingContext for ExplorerViewModelHelper.ProcessModelChangesCommitted()");
var artifacts = new HashSet<EFArtifact>();
artifacts.Add(serviceFromContext.Artifact);
return artifacts;
}
示例6: GetCurrentArtifactsInView
protected override HashSet<EFArtifact> GetCurrentArtifactsInView(EditingContext context)
{
var artifacts = new HashSet<EFArtifact>();
var service = context.GetEFArtifactService();
var entityDesignArtifact = service.Artifact as EntityDesignArtifact;
Debug.Assert(
entityDesignArtifact != null,
"The active artifact is not type of: " + typeof(EntityDesignArtifact) + ", Actual:" + service.Artifact.GetType());
if (entityDesignArtifact != null)
{
artifacts.Add(entityDesignArtifact);
if (entityDesignArtifact.DiagramArtifact != null)
{
artifacts.Add(entityDesignArtifact.DiagramArtifact);
}
}
return artifacts;
}
示例7: GetDocData
private static MicrosoftDataEntityDesignDocData GetDocData(EditingContext editingContext)
{
Debug.Assert(editingContext != null, "editingContext != null");
var artifactService = editingContext.GetEFArtifactService();
return (MicrosoftDataEntityDesignDocData)VSHelpers.GetDocData(ServiceProvider, artifactService.Artifact.Uri.LocalPath);
}
示例8: CreateDefaultDiagram
internal static void CreateDefaultDiagram(EditingContext context, EntityDesignerDiagram diagram)
{
var service = context.GetEFArtifactService();
var artifact = service.Artifact;
Debug.Assert(artifact != null, "Artifact is null");
var cpc = new CommandProcessorContext(
context, EfiTransactionOriginator.EntityDesignerOriginatorId, EntityDesignerResources.Tx_CreateDiagram);
var cmd = new DelegateCommand(
() =>
{
EntityDesignerDiagramAdd.StaticInvoke(cpc, diagram);
foreach (var shapeElement in diagram.NestedChildShapes)
{
var entityShape = shapeElement as EntityTypeShape;
if (entityShape != null)
{
EntityTypeShapeAdd.StaticInvoke(cpc, entityShape);
EntityTypeShapeChange.StaticInvoke(
cpc, entityShape, ViewModelDiagram.NodeShape.AbsoluteBoundsDomainPropertyId);
EntityTypeShapeChange.StaticInvoke(cpc, entityShape, ViewModelDiagram.NodeShape.IsExpandedDomainPropertyId);
continue;
}
var associationConnector = shapeElement as AssociationConnector;
if (associationConnector != null)
{
AssociationConnectorAdd.StaticInvoke(cpc, associationConnector);
AssociationConnectorChange.StaticInvoke(
cpc, associationConnector, ViewModelDiagram.LinkShape.EdgePointsDomainPropertyId);
AssociationConnectorChange.StaticInvoke(
cpc, associationConnector, ViewModelDiagram.LinkShape.ManuallyRoutedDomainPropertyId);
continue;
}
var inheritanceConnector = shapeElement as InheritanceConnector;
if (inheritanceConnector != null)
{
InheritanceConnectorAdd.StaticInvoke(cpc, inheritanceConnector);
InheritanceConnectorChange.StaticInvoke(
cpc, inheritanceConnector, ViewModelDiagram.LinkShape.EdgePointsDomainPropertyId);
InheritanceConnectorChange.StaticInvoke(
cpc, inheritanceConnector, ViewModelDiagram.LinkShape.ManuallyRoutedDomainPropertyId);
continue;
}
}
});
CommandProcessor.InvokeSingleCommand(cpc, cmd);
}
示例9: AddNewEnumType
// <summary>
// Show the dialog to create a new enum type.
// </summary>
public static EnumType AddNewEnumType(
string selectedUnderlyingType, EditingContext editingContext, string originatingId, EventHandler onDialogActivated = null)
{
if (editingContext == null)
{
throw new ArgumentNullException("editingContext");
}
var artifactService = editingContext.GetEFArtifactService();
var entityDesignArtifact = artifactService.Artifact as EntityDesignArtifact;
Debug.Assert(
entityDesignArtifact != null,
typeof(EntityDesignViewModelHelper).Name
+ ".AddEnumType: Unable to find Entity Design Artifact from the passed in editing context.");
if (entityDesignArtifact != null)
{
var vm = new EnumTypeViewModel(entityDesignArtifact, selectedUnderlyingType);
var result = ShowEnumTypeDialog(vm, onDialogActivated);
if (result == true
&& vm.IsValid)
{
var cp = new CommandProcessor(editingContext, originatingId, Resources.Tx_CreateEnumType);
var createEnumTypeCommand = new CreateEnumTypeCommand(
vm.Name, vm.SelectedUnderlyingType
, (vm.IsReferenceExternalType ? vm.ExternalTypeName : String.Empty), vm.IsFlag, false);
cp.EnqueueCommand(createEnumTypeCommand);
foreach (var member in vm.Members)
{
if (String.IsNullOrWhiteSpace(member.Name) == false)
{
cp.EnqueueCommand(new CreateEnumTypeMemberCommand(createEnumTypeCommand, member.Name, member.Value));
}
}
cp.Invoke();
return createEnumTypeCommand.EnumType;
}
}
return null;
}