public static IProject BuildProj(string filePath) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(filePath); string attr = xmlDoc.FirstChild.Name; IProject proj = null; if (attr == "EntityProj") { proj = new BEProj(filePath, string.Empty); } else if (attr == "BPProj") { proj = new BPProj(filePath, string.Empty); } return proj; }
public static IProject CreateProject(string ns, string projName) { BEProj proj = new BEProj(string.Empty, System.Guid.NewGuid().ToString()); proj.ProjName = projName; proj.Namespace = ns; //添加自我引用 ProjectRefrence pr = new ProjectRefrence(proj, System.Guid.NewGuid().ToString(), string.Empty); pr.RefProjName = proj.ProjName + ".be"; pr.Code = pr.Name = proj.Namespace + ".dll"; pr.RefrenceType = Net.Code.Builder.Enums.RefType.BEEntity; proj.RefrenceList.Add(pr); pr = new ProjectRefrence(proj, System.Guid.NewGuid().ToString(), string.Empty); pr.RefProjName = proj.ProjName + ".be"; pr.Code = pr.Name = proj.Namespace + ".Deploy.dll"; pr.RefrenceType = Net.Code.Builder.Enums.RefType.Deploy; proj.RefrenceList.Add(pr); proj.ToFile(); return proj; }
private List<BEEntity> ReSortBE(List<BEEntity> entityList, BEProj proj) { List<BEEntity> hasSelectedList = new List<BEEntity>(); int index = 0; while (entityList.Count > 0) { index = index % entityList.Count; BEEntity entity = entityList[index]; bool hasRefrenece = false; foreach (BEColumn col in entity.ColumnList) { if (col.DataType == DataTypeEnum.RefreceType && !col.IsEnum) { //自引用的不需要处理 if (col.RefGuid == entity.Guid) { continue; } string ns = col.TypeString.Substring(0, col.TypeString.LastIndexOf('.')); if (ns == proj.Namespace) { bool contain = false; foreach (BEEntity be in hasSelectedList) { string fullName = proj.Namespace + "." + be.Code; if (fullName == col.TypeString) { contain = true; } } if (!contain) { hasRefrenece = true; break; } } } } if (!hasRefrenece) { entityList.RemoveAt(index); hasSelectedList.Add(entity); } else { index++; } } return hasSelectedList; }
public BuildEntityProj(BEProj proj) { _proj = proj; }
public BEColumn(string guid, BEProj proj, BEEntity entity) : base(guid) { this._guid = guid; this._proj = proj; this._entity = entity; this.DataState = DataState.Add; }
public BEEntity(BEProj proj, string guid, string floderGuid) : base(guid) { _floderGuid = floderGuid; _proj = proj; this.DataState = DataState.Add; this.IsChanged = true; }