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); }
/// <summary> /// Creates DataStore roslyn document /// </summary> internal void CreateStoreDocument(DataStoreNode node) { var docName = $"sys.DataStore.{node.Model.Name}.cs"; var newSolution = Workspace.CurrentSolution.AddDocument(node.RoslynDocumentId, docName, CodeGenService.GenDataStoreDummyCode(node.Model)); if (!Workspace.TryApplyChanges(newSolution)) { Log.Warn($"Cannot add roslyn document for: {node.Model.Name}"); } }