maliming / abp.generaltree Goto Github PK
View Code? Open in Web Editor NEWFor Abp vNext
Home Page: https://github.com/maliming/Owl.GeneralTree
License: MIT License
For Abp vNext
Home Page: https://github.com/maliming/Owl.GeneralTree
License: MIT License
在 GeneralTreeManager<TTree, TPrimaryKey> 对象的TraverseTree方法中
是否可以添加
tree.Parent = parent;
这样就可在childrenAction中使用到父节点的一些自定义字段
Hi maliming
Thank you for this project!
Asp.NET Boilerplate now have Multi Lingual Entities
https://www.aspnetboilerplate.com/Pages/Documents/Multi-Lingual-Entities
Could you add Multi Lingual Entities support to GeneralTree
For example, Regions will get collection of translations
public ICollection<RegionTranslation> Translations { get; set; }
and members Name and FullName move to RegionTranslation
public class RegionTranslation: Entity, IEntityTranslation<Region>
{
public string Name { get; set; }
public string FullName { get; set; }
public Region Core { get; set; }
public int CoreId { get; set; }
public string Language { get; set; }
}
我使用UpdateAsync更新实体时候,发现只要对实体进行修改就会导致实体的Code值变化到最后一个,而且其子类的code值也没有跟着变动
我查看了我nuget包里的Abp.GeneralTree 2.3.2 发现和发布版本相代码比较,发现不一样的地方,我的nuget包里多了几行,估计就是这里改变了code值,请检查一下是不是打包的时候用错分支了
[UnitOfWork]
public virtual async Task UpdateAsync(TTree tree, Action childrenAction = null)
{
this.CheckSameName(tree);
string oldFullName = tree.FullName;
if (tree.ParentId.HasValue)
{
TTree tree2 = await this._generalTreeRepository.FirstOrDefaultAsync(GeneralTreeManager<TTree, TPrimaryKey>.EqualId(tree.ParentId.Value));
Check.NotNull(tree2, "parent");
tree.FullName = tree2.FullName + this._generalTreeConfiguration.Hyphen + tree.Name;
}
else
tree.FullName = tree.Name;
//多出来的部分
TTree tree1 = tree;
tree1.Code = await this.GetNextChildCodeAsync(tree.ParentId);
tree1 = default (TTree);
//
tree.Level = tree.Code.Split('.').Length;
foreach (TTree tree2 in await this.GetChildrenAsync(new TPrimaryKey?(tree.Id), true))
{
tree2.FullName = this._generalTreeCodeGenerate.MergeFullName(tree.FullName, this._generalTreeCodeGenerate.RemoveParentCode(tree2.FullName, oldFullName));
Action action = childrenAction;
if (action != null)
action(tree2);
}
}
大部分情况下我们需要的树形数据都很简单,所以我想在你的模块上提供一个默认实现(假如叫DefaultTree),关于持久化有两种想法
1、在模块内部实现持久化
在DefaultTree.Core中定义DefaultTreeEntity,实现IGeneralTree<TTree, TPrimaryKey>
在DefaultTree.EF中定义DBCotnext,其中定义DbSet
甚至继续提供应用服务TreeAppService、和一个通用的UI
2、模块中不处理持久化
在DefaultTree.Core中定义DefaultTreeEntity,实现IGeneralTree<TTree, TPrimaryKey>
在**主程序(也就是模块的使用方)**的DbContext去定义DbSet
前者这种方式如果我的系统有很多模块都涉及到持久化,那么我可能需要很多DbContext
后者这种方式感觉封装性不够强
请教下你有好的建议吗? 还是我哪想错了?
2.4.2是Abp4.2.0的,3.0.0直接跳到了5.0.0。
5.0.0与4.x差别有点大,暂不打算升级,4.11.0与4.2.0AppService部分改了,直接使用2.4.2会造成前端abp.service未定义。
能发布个Abp 4.11.0版本的吗?
.Any(x => x.Name == tree.Name)
是不是可以改成
.Any(x => x.Name.Equals(tree.Name, StringComparison.OrdinalIgnoreCase))
从设计上是考虑用Code字段进行排序么,目前Move方法好像只是调整层级,请问大佬有没有比较好的允许用户手动调整树节点顺序的设计思路?
这个模块挺有用,不知道有没有 vnext的模块开发计划
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.