/// <summary> /// SysStore及SqlStore通用 /// </summary> private static async Task RemoveIndex(DesignHub hub, string appName, EntityModel entityModel, byte indexId) { if (entityModel.StoreOptions == null) { throw new InvalidOperationException("Can't remove index for DTO"); } if (!entityModel.StoreOptions.HasIndexes) { throw new Exception($"EntityModel[{entityModel.Name}] not has any indexes."); } var index = entityModel.StoreOptions.Indexes.SingleOrDefault(t => t.IndexId == indexId); if (index == null) { throw new Exception($"EntityModel[{entityModel.Name}] has no index: {indexId}"); } if (entityModel.SysStoreOptions != null) { //查询服务代码引用项 var refs = await RefactoringService.FindUsagesAsync(hub, ModelReferenceType.EntityIndexName, appName, entityModel.Name, index.Name); if (refs != null && refs.Count > 0) { throw new Exception($"EntityIndex[{entityModel.Name}.{index.Name}] has references."); } } index.MarkDeleted(); }
public Task <object> Handle(DesignHub hub, InvokeArgs args) { int threadId = args.GetInt32(); hub.DebugService.Continue(threadId); return(Task.FromResult <object>(null)); }
public async Task <object> Handle(DesignHub hub, InvokeArgs args) { // 获取接收到的参数 string appName = args.GetString(); //string localizedName = args.GetObject() as string; var node = hub.DesignTree.FindApplicationNodeByName(appName); if (node != null) { throw new Exception("Application has existed."); } if (System.Text.Encoding.UTF8.GetByteCount(appName) > 8) { throw new Exception("Application name too long"); } var appRootNode = hub.DesignTree.AppRootNode; var appModel = new ApplicationModel("appbox", appName); //TODO:fix owner var appNode = new ApplicationNode(hub.DesignTree, appModel); appRootNode.Nodes.Add(appNode); // 直接创建并保存 await Store.ModelStore.CreateApplicationAsync(appModel); return(new NewNodeResult { ParentNodeType = (int)appRootNode.NodeType, ParentNodeID = appRootNode.ID, NewNode = appNode }); }
public async Task <object> Handle(DesignHub hub, InvokeArgs args) { var staged = await StagedService.LoadStagedAsync(onlyModelsAndFolders : false); //TODO:暂重新加载 hub.PendingChanges = staged.Items; if (hub.PendingChanges == null || hub.PendingChanges.Length == 0) { return(null); } var res = new List <ChangedInfo>(); for (int i = 0; i < hub.PendingChanges.Length; i++) { //TODO:其他类型处理 if (hub.PendingChanges[i] is ModelBase model) { res.Add(new ChangedInfo { ModelType = model.ModelType.ToString(), ModelID = model.Name }); } else if (hub.PendingChanges[i] is ModelFolder folder) { res.Add(new ChangedInfo { ModelType = ModelType.Folder.ToString(), ModelID = folder.TargetModelType.ToString() }); } } return(res); }
public async Task <object> Handle(DesignHub hub, InvokeArgs args) { var modelID = args.GetString(); var methodName = args.GetString(); var methodArgs = args.GetString(); var breakpoints = args.GetString(); //先编译服务模型,将编译结果保存至当前会话的调试目录内 var debugFolder = Path.Combine(Runtime.RuntimeContext.Current.AppPath, "debug", hub.Session.SessionID.ToString()); if (Directory.Exists(debugFolder)) { Directory.Delete(debugFolder, true); } Directory.CreateDirectory(debugFolder); var serviceNode = hub.DesignTree.FindModelNode(ModelType.Service, ulong.Parse(modelID)); await PublishService.CompileServiceAsync(hub, (ServiceModel)serviceNode.Model, debugFolder); //释放第三方组件库 TODO:暂简单实现 var debugLibPath = Path.Combine(debugFolder, "lib"); await Store.ModelStore.ExtractAppAssemblies(serviceNode.AppNode.Model.Name, debugLibPath); //启动调试进程 var appName = serviceNode.AppNode.Model.Name; hub.DebugService.DebugSourcePath = $"{appName}.Services.{serviceNode.Model.Name}.cs"; hub.DebugService.StartDebugger($"{appName}.{serviceNode.Model.Name}.{methodName}", methodArgs, breakpoints); return(null); }
public Task <object> Handle(DesignHub hub, InvokeArgs args) { string modelId = args.GetString(); ModelNode[] modelNodes; if (string.IsNullOrEmpty(modelId)) //空表示所有模型用于初次加载 { modelNodes = hub.DesignTree.FindNodesByType(ModelType.Entity); } else //指定标识用于更新 { ulong id = ulong.Parse(modelId); var node = hub.DesignTree.FindModelNode(ModelType.Entity, id); modelNodes = new ModelNode[] { node }; } List <TypeScriptDeclare> list = new List <TypeScriptDeclare>(); foreach (var node in modelNodes) { list.Add(new TypeScriptDeclare { Name = $"{node.AppNode.Model.Name}.Entities.{node.Model.Name}", Declare = BuildDeclare(node, hub) }); } return(Task.FromResult <object>(list)); }
public async Task <object> Handle(DesignHub hub, InvokeArgs args) { var modelID = args.GetString(); // eg: sys.CustomerListView var sr = modelID.Split('.'); var app = hub.DesignTree.FindApplicationNodeByName(sr[0]); var node = hub.DesignTree.FindModelNodeByName(app.Model.Id, ModelType.View, sr[1]); if (node == null) { throw new Exception("Cannot found view node: " + modelID); } var modelNode = node as ModelNode; if (modelNode == null) { throw new Exception("Cannot found view model: " + modelID); } string runtimeCode = null; if (modelNode.IsCheckoutByMe) { runtimeCode = await StagedService.LoadViewRuntimeCode(modelNode.Model.Id); } if (string.IsNullOrEmpty(runtimeCode)) { runtimeCode = await Store.ModelStore.LoadViewAssemblyAsync(modelID); } return(runtimeCode); }
public async Task <object> Handle(DesignHub hub, InvokeArgs args) { int selectedNodeType = args.GetInt32(); string selectedNodeId = args.GetString(); var deleteNode = hub.DesignTree.FindNode((DesignNodeType)selectedNodeType, selectedNodeId); if (deleteNode == null) { throw new Exception("Delete target not exists."); } if (!(deleteNode is ModelNode || deleteNode is ApplicationNode || deleteNode.NodeType == DesignNodeType.FolderNode && deleteNode.Nodes.Count == 0)) { throw new Exception("Can not delete it."); } DesignNode rootNode = null; if (deleteNode is ModelNode modelNode) { rootNode = await DeleteModelNode(hub, modelNode); } else if (deleteNode is ApplicationNode appNode) { await DeleteApplicationNode(hub, appNode); } else { throw ExceptionHelper.NotImplemented(); //rootNode = DeleteFolderNode(hub, deleteNode); } //注意:返回rootNode.ID用于前端重新刷新模型根节点 return(rootNode == null ? string.Empty : rootNode.ID); }
public async Task <object> Handle(DesignHub hub, InvokeArgs args) { //TODO:先判断DataStoreRootNode有没有被当前用户签出 // 获取接收到的参数 var storeType = (DataStoreKind)args.GetInt32(); var storeProvider = args.GetString(); var storeName = args.GetString(); // 验证类名称的合法性 if (string.IsNullOrEmpty(storeName)) { throw new Exception("DataStore name can not be null"); } if (!CodeHelper.IsValidIdentifier(storeName) || storeName == "Default") { throw new Exception("DataStore name invalid"); } // TODO: 验证名称是否已存在 // 开始新建存储节点 var model = new DataStoreModel(storeType, storeProvider, storeName); //添加节点至模型树并绑定签出信息 var node = hub.DesignTree.StoreRootNode.AddModel(model, hub); // 保存至本地 await node.SaveAsync(); // 新建RoslynDocument hub.TypeSystem.CreateStoreDocument(node); return(node); }
public ServiceDeclareGenerator(DesignHub hub, string appName, SemanticModel semanticModel, ServiceModel serviceModel) { this.hub = hub; AppName = appName; SemanticModel = semanticModel; ServiceModel = serviceModel; }
public Task <object> Handle(DesignHub hub, InvokeArgs args) { var modelID = args.GetString(); var routeEnable = args.GetBoolean(); var routeParent = args.GetString(); var routePath = args.GetString(); if (routeEnable && !string.IsNullOrEmpty(routeParent) && string.IsNullOrEmpty(routePath)) { throw new InvalidOperationException("Assign RouteParent must set RoutePath"); } //TODO:判断路径有效性,以及是否重复 var modelNode = hub.DesignTree.FindModelNode(ModelType.View, ulong.Parse(modelID)); if (modelNode == null) { throw new Exception($"Cannot find view model node: {modelID}"); } var viewModel = (ViewModel)modelNode.Model; viewModel.Flag = routeEnable == true ? ViewModelFlag.ListInRouter : ViewModelFlag.None; viewModel.RouteParent = routeParent; viewModel.RoutePath = routePath; return(Task.FromResult <object>(true)); }
public Task <object> Handle(DesignHub hub, InvokeArgs args) { var nodeType = (DesignNodeType)args.GetInt32(); var modelID = args.GetString(); //Log.Debug($"nodeType={nodeType} modelId={modelID}"); if (nodeType == DesignNodeType.ServiceModelNode) { var modelNode = hub.DesignTree.FindModelNode(ModelType.Service, ulong.Parse(modelID)); if (modelNode != null) //可能已被删除了,即由删除节点引发的关闭设计器 { var fileName = $"{modelNode.AppNode.Model.Name}.Services.{modelNode.Model.Name}.cs"; var document = hub.TypeSystem.Workspace.GetOpenedDocumentByName(fileName); if (document != null) { hub.TypeSystem.Workspace.CloseDocument(document.Id); } } } else if (nodeType == DesignNodeType.WorkflowModelNode) { throw ExceptionHelper.NotImplemented(); //var sr = modelID.Split('.'); //var modelNode = hub.DesignTree.FindModelNode(ModelType.Workflow, sr[0], sr[1]); //hub.WorkflowDesignService.CloseWorkflowModel(modelNode); } return(Task.FromResult <object>(null)); }
public DebugService(DesignHub hub) { _hub = hub; _pendingReqs = new Dictionary <int, Action <string> >(); _debugSessionID = new Guid(); _programCWD = Runtime.RuntimeContext.Current.AppPath; _programPath = Path.Combine(_programCWD, "appbox.AppContainer"); }
public ServiceCodeGenerator(DesignHub hub, string appName, SemanticModel semanticModel, ServiceModel serviceModel) { this.hub = hub; AppName = appName; SemanticModel = semanticModel; ServiceModel = serviceModel; queryMethodCtx = new QueryMethodContext(); }
public async Task <object> Handle(DesignHub hub, InvokeArgs args) { string fileName = args.GetString(); string tempFile = args.GetString(); string appName = args.GetString(); if (string.IsNullOrEmpty(appName)) { throw new ArgumentException("必须指明App"); } //找到对应的ApplicationNode var appNode = hub.DesignTree.FindApplicationNodeByName(appName); if (appNode == null) { throw new Exception("未能找到应用节点: " + appName); } //判断组件类型 AssemblyPlatform platform = AssemblyPlatform.Common; var ext = Path.GetExtension(fileName); if (ext == "so") { platform = AssemblyPlatform.Linux; } else if (ext == "dylib") { platform = AssemblyPlatform.OSX; } else if (!IsDotNetAssembly(tempFile)) { platform = AssemblyPlatform.Windows; } //压缩组件 using var dllStream = new MemoryStream(1024); using var cs = new BrotliStream(dllStream, CompressionMode.Compress, true); using var fs = File.OpenRead(tempFile); await fs.CopyToAsync(cs); await cs.FlushAsync(); var asmData = dllStream.ToArray(); //保存组件 var asmName = $"{appName}.{fileName}"; await Store.ModelStore.UpsertAppAssemblyAsync(asmName, asmData, platform); //TODO:***** // 1. 通知所有DesignHub.TypeSystem更新MetadataReference缓存,并更新相关项目引用 //TypeSystem.RemoveMetadataReference(fileName, appID); // 2. 如果相应的AppContainer已启动,通知其移除所有引用该第三方组件的服务实例缓存,使其自动重新加载 // 3. 如果集群模式,通知集群其他节点做上述1,2操作 return(platform == AssemblyPlatform.Common ? true : false); //返回true表示.net 组件可引用, false表示native不可直接引用 }
internal DataStoreNode AddModel(DataStoreModel model, DesignHub hub) { //注意model可能被签出的本地替换掉,所以相关操作必须指向node.Model var node = new DataStoreNode(model, hub); DesignTree.BindCheckoutInfo(node, model.PersistentState == PersistentState.Detached); Nodes.Add(node); return(node); }
public async Task <object> Handle(DesignHub hub, InvokeArgs args) { var appName = args.GetString(); var path = args.GetString(); var app = await RuntimeContext.Current.GetApplicationModelAsync(appName); return(await Store.BlobStore.ListAsync(app.StoreId, path)); }
public Task <object> Handle(DesignHub hub, InvokeArgs args) { var modelID = args.GetString(); var array = args.GetObjectArray(); var newDeps = array != null?array.Cast <string>().ToArray() : new string[0]; var modelNode = hub.DesignTree.FindModelNode(ModelType.Service, ulong.Parse(modelID)); if (modelNode == null) { throw new Exception("Can't find service model node"); } var model = (ServiceModel)modelNode.Model; var appName = modelNode.AppNode.Model.Name; //开始比对 //bool hasChanged = false; if (model.HasReference) { //先处理移除的 for (int i = model.References.Count - 1; i >= 0; i--) { if (!newDeps.Contains(model.References[i])) { hub.TypeSystem.RemoveServiceReference(modelNode.ServiceProjectId, appName, model.References[i]); model.References.RemoveAt(i); //hasChanged = true; } } //再处理新增的 for (int i = 0; i < newDeps.Length; i++) { if (!model.References.Contains(newDeps[i])) { hub.TypeSystem.AddServiceReference(modelNode.ServiceProjectId, appName, newDeps[i]); model.References.Add(newDeps[i]); //hasChanged = true; } } } else if (newDeps.Length > 0) { for (int i = 0; i < newDeps.Length; i++) { hub.TypeSystem.AddServiceReference(modelNode.ServiceProjectId, appName, newDeps[i]); model.References.Add(newDeps[i]); } //hasChanged = true; } //if (hasChanged) // await modelNode.SaveAsync(null); return(Task.FromResult((object)null)); }
internal static Task <List <Reference> > FindUsagesAsync(DesignHub hub, ModelReferenceType referenceType, string appName, string modelName, string memberName) { return(referenceType switch { ModelReferenceType.EntityMemberName => FindEntityMemberReferencesAsync(hub, appName, modelName, memberName), ModelReferenceType.EntityIndexName => FindEntityIndexReferencesAsync(hub, appName, modelName, memberName), ModelReferenceType.EnumModelItemName => FindEnumItemReferencesAsync(hub, appName, modelName, memberName), _ => throw new NotImplementedException(referenceType.ToString()), });
public async Task <object> Handle(DesignHub hub, InvokeArgs args) { var refType = (ModelReferenceType)args.GetInt32(); var modelID = args.GetString(); var oldName = args.GetString(); var newName = args.GetString(); return(await RefactoringService.RenameAsync(hub, refType, ulong.Parse(modelID), oldName, newName)); }
public async Task <object> Handle(DesignHub hub, InvokeArgs args) { var modelID = args.GetString(); var line = args.GetInt32() - 1; var column = args.GetInt32() - 1; var modelNode = hub.DesignTree.FindModelNode(ModelType.Service, ulong.Parse(modelID)); if (modelNode == null) { throw new Exception("Can't find service model node"); } //定位服务入口方法 var doc = hub.TypeSystem.Workspace.CurrentSolution.GetDocument(modelNode.RoslynDocumentId); var semanticModel = await doc.GetSemanticModelAsync(); var sourceText = await doc.GetTextAsync(); var position = sourceText.Lines.GetPosition(new LinePosition(line, column)); var symbol = await SymbolFinder.FindSymbolAtPositionAsync(semanticModel, position, hub.TypeSystem.Workspace); if (symbol == null) { throw new Exception("Can't find service method"); } if (symbol.Kind != SymbolKind.Method) { throw new Exception("Not a method"); } if (symbol.ContainingType.ToString() != string.Format("{0}.ServiceLogic.{1}", modelNode.AppNode.ID, modelNode.Model.Name)) { throw new Exception("Not a service method"); } if (symbol.DeclaredAccessibility.ToString() != "Public") { throw new Exception("Not a service method"); } IMethodSymbol method = symbol as IMethodSymbol; var sb = new StringBuilder("{\"Name\":\""); sb.Append(method.Name); sb.Append("\", \"Args\":["); for (int i = 0; i < method.Parameters.Length; i++) { sb.AppendFormat("{{\"Name\":\"{0}\",\"Type\":\"{1}\"}}", method.Parameters[i].Name, method.Parameters[i].Type); if (i != method.Parameters.Length - 1) { sb.Append(","); } } sb.Append("]}"); return(sb.ToString()); }
public async Task <object> Handle(DesignHub hub, InvokeArgs args) { var nodeType = (DesignNodeType)args.GetInt32(); var nodeID = args.GetString(); var node = hub.DesignTree.FindNode(nodeType, nodeID); if (node == null) { throw new Exception($"Can't find DesignNode: {nodeID}"); } var modelNode = node as ModelNode; if (modelNode != null) { var curVersion = modelNode.Model.Version; bool checkoutOk = await modelNode.Checkout(); if (!checkoutOk) { throw new Exception($"Can't checkout ModelNode: {nodeID}"); } if (curVersion != modelNode.Model.Version) { return(true); //返回True表示模型已变更,用于前端刷新 } } else if (node.NodeType == DesignNodeType.ModelRootNode) { bool checkoutOk = await node.Checkout(); if (!checkoutOk) { throw new Exception("Can't checkout ModelRootNode"); } return(true); //TODO:暂返回需要更新 } else if (node.NodeType == DesignNodeType.DataStoreNode) { bool checkoutOk = await node.Checkout(); if (!checkoutOk) { throw new Exception("Can't checkout DataStoreNode"); } return(false); } else { throw new Exception("无法签出此类型的节点"); } return(false); }
private static async Task ImportApp(DesignHub ctx, AppPackage pkg) { //TODO:暂重用更新逻辑简单实现 //先创建应用,必须添加到设计树内,因保存实体模型时获取表名需要用到 var appRootNode = ctx.DesignTree.AppRootNode; var appNode = new ApplicationNode(ctx.DesignTree, pkg.Application); appRootNode.Nodes.Add(appNode); await ModelStore.CreateApplicationAsync(pkg.Application); await UpdateApp(ctx, pkg, pkg.Application); }
public async Task <object> Handle(DesignHub hub, InvokeArgs args) { string modelId = args.GetString(); string itemName = args.GetString(); int value = args.GetInt32(); string comment = args.GetString(); var node = hub.DesignTree.FindModelNode(ModelType.Enum, ulong.Parse(modelId)); if (node == null) { throw new Exception("Can't find enum model node"); } var model = (EnumModel)node.Model; if (!node.IsCheckoutByMe) { throw new Exception("Node has not checkout"); } if (!CodeHelper.IsValidIdentifier(itemName)) { throw new Exception("Name is invalid"); } if (itemName == model.Name) { throw new Exception("Name can not same as Enum name"); } if (model.Items.FirstOrDefault(t => t.Name == itemName) != null) { throw new Exception("Name has exists"); } if (model.Items.FirstOrDefault(t => t.Value == value) != null) { throw new Exception("Value has exists"); } var item = new EnumModelItem(itemName, value); if (!string.IsNullOrEmpty(comment)) { item.Comment = comment; } model.Items.Add(item); // 保存到本地 await node.SaveAsync(null); // 更新RoslynDocument await hub.TypeSystem.UpdateModelDocumentAsync(node); return(item); }
public Task <object> Handle(DesignHub hub, InvokeArgs args) { var targetEntityModelID = args.GetString(); var refModels = hub.DesignTree.FindEntityRefModels(ulong.Parse(targetEntityModelID)); object res = refModels.Select(t => new { Path = $"{hub.DesignTree.FindApplicationNode(t.Owner.AppId).Model.Name}.{t.Owner.Name}.{t.Name}", EntityID = t.Owner.Id.ToString(), //ulong转换为string MemberID = t.MemberId, }).ToArray(); return(Task.FromResult(res)); }
private static string BuildDeclare(ModelNode node, DesignHub hub) { var app = node.AppNode.Model.Name; var model = (EntityModel)node.Model; var sb = StringBuilderCache.Acquire(); sb.Append($"declare namespace {app}.Entities{{"); sb.Append($"declare class {model.Name} extends EntityBase{{"); //注意:前端不关注成员是否readonly,以方便UI绑定如主键值 foreach (var m in model.Members) { string type = "any"; switch (m.Type) { case EntityMemberType.DataField: type = GetDataFieldType((DataFieldModel)m); break; case EntityMemberType.EntityRef: { var rm = (EntityRefModel)m; for (int i = 0; i < rm.RefModelIds.Count; i++) { var target = hub.DesignTree.FindModelNode(ModelType.Entity, rm.RefModelIds[i]); var typeName = $"{target.AppNode.Model.Name}.Entities.{target.Model.Name}"; if (i == 0) { type = typeName; } else { type += $" | {typeName}"; } } } break; case EntityMemberType.EntitySet: { var sm = (EntitySetModel)m; var target = hub.DesignTree.FindModelNode(ModelType.Entity, sm.RefModelId); type = $"{target.AppNode.Model.Name}.Entities.{target.Model.Name}[]"; } break; } //TODO:处理注释 sb.Append($"{m.Name}:{type};"); } sb.Append("}}"); return(StringBuilderCache.GetStringAndRelease(sb)); }
public async Task <object> Handle(DesignHub hub, InvokeArgs args) { string commitMessage = args.GetString(); if (hub.PendingChanges == null || hub.PendingChanges.Length == 0) { return(null); } //将PendingChanges转为PublishPackage var package = new PublishPackage(); for (int i = 0; i < hub.PendingChanges.Length; i++) { var change = hub.PendingChanges[i]; switch (change) { case ModelBase model: package.Models.Add(model); break; case ModelFolder folder: package.Folders.Add(folder); break; case StagedItems.StagedSourceCode code: package.SourceCodes.Add(code.ModelId, code.CodeData); break; case StagedItems.StagedViewRuntimeCode viewAsm: { //先找到名称 var viewModelNode = hub.DesignTree.FindModelNode(ModelType.View, viewAsm.ModelId); string asmName = $"{viewModelNode.AppNode.Model.Name}.{viewModelNode.Model.Name}"; package.ViewAssemblies.Add(asmName, viewAsm.CodeData); } break; default: Log.Warn($"Unknow pending change: {change.GetType()}"); break; } } PublishService.ValidateModels(hub, package); await PublishService.CompileModelsAsync(hub, package); await PublishService.PublishAsync(hub, package, commitMessage); //最后清空临时用的PendingChanges hub.PendingChanges = null; return(null); }
public Task <object> Handle(DesignHub hub, InvokeArgs args) { var modelID = args.GetString(); var modelNode = hub.DesignTree.FindModelNode(ModelType.Enum, ulong.Parse(modelID)); if (modelNode == null) { throw new Exception("Can't find EnumModel."); } var enumModel = (EnumModel)modelNode.Model; return(Task.FromResult <object>(enumModel.Items)); }
public ModelNode(ModelBase targetModel, DesignHub hub) //注意:新建时尚未加入树,无法获取TreeView实例 { AppNode = hub.DesignTree.FindApplicationNode(targetModel.AppId); Model = targetModel; Text = targetModel.Name; switch (targetModel.ModelType) { case ModelType.Entity: RoslynDocumentId = DocumentId.CreateNewId(hub.TypeSystem.ModelProjectId); nodeType = DesignNodeType.EntityModelNode; break; case ModelType.Service: ServiceProjectId = ProjectId.CreateNewId(); RoslynDocumentId = DocumentId.CreateNewId(ServiceProjectId); nodeType = DesignNodeType.ServiceModelNode; AsyncProxyDocumentId = DocumentId.CreateNewId(hub.TypeSystem.AsyncServiceProxyProjectId); break; case ModelType.View: nodeType = DesignNodeType.ViewModelNode; break; case ModelType.Report: nodeType = DesignNodeType.ReportModelNode; break; case ModelType.Enum: RoslynDocumentId = DocumentId.CreateNewId(hub.TypeSystem.ModelProjectId); nodeType = DesignNodeType.EnumModelNode; break; case ModelType.Event: nodeType = DesignNodeType.EventModelNode; break; case ModelType.Permission: RoslynDocumentId = DocumentId.CreateNewId(hub.TypeSystem.ModelProjectId); nodeType = DesignNodeType.PermissionModelNode; break; case ModelType.Workflow: RoslynDocumentId = DocumentId.CreateNewId(hub.TypeSystem.WorkflowModelProjectId); nodeType = DesignNodeType.WorkflowModelNode; break; } }
private static void RemoveRoslynFromModelNode(DesignHub hub, ModelNode node) { if (node.RoslynDocumentId != null) { hub.TypeSystem.RemoveDocument(node.RoslynDocumentId); } if (node.AsyncProxyDocumentId != null) { hub.TypeSystem.RemoveDocument(node.AsyncProxyDocumentId); } if (node.ServiceProjectId != null) //注意:服务模型移除整个虚拟项目 { hub.TypeSystem.RemoveServiceProject(node.ServiceProjectId); } }