Skip to content

Releases: maliming/Abp.GeneralTree

Update Abp to 5.1, support for net core 3.1!

23 Dec 00:35
6e6e1f3
Compare
Choose a tag to compare

Update Abp to 5.0, support for net core 3.0!

09 Nov 01:50
Compare
Choose a tag to compare
3.0.0

Update Abp to 5.0, support for net core 3.0!

2.4.2

24 Feb 08:05
Compare
Choose a tag to compare
  • Fix #11 potential memory leak because of ef core query cache.
  • Update Abp to 4.2.0

Update Abp to 4.0.2

07 Dec 06:39
Compare
Choose a tag to compare
2.4.1

Update Abp to 4.0.2

There is a bug in v2.3.0 to v2.3.2, please download the latest version.

25 Sep 04:54
Compare
Choose a tag to compare

There is a bug in v2.3.0 to v2.3.2, please download the latest version.

Update Abp to 3.8.2

12 Sep 01:38
Compare
Choose a tag to compare

update Abp to 3.8.2

GeneralTreeExtensions ToTree Method Children Support Sorting.

27 May 11:12
Compare
Choose a tag to compare
[Fact]
public void ToTreeOrderBy_Test()
{
	var regions = new List<Regin>
	{
		new Regin
		{
			Id = 1,
			Name = "b北京"
		},
		new Regin
		{
			Id = 2,
			Name = "b东城区",
			ParentId = 1
		},
		new Regin
		{
			Id = 3,
			Name = "a西城区",
			ParentId = 1
		},
		new Regin
		{
			Id = 4,
			Name = "a河北"
		},
		new Regin
		{
			Id = 5,
			Name = "b石家庄",
			ParentId = 4
		},
		new Regin
		{
			Id = 6,
			Name = "a承德",
			ParentId = 4
		},
		new Regin
		{
			Id = 7,
			Name = "b双桥区",
			ParentId = 6
		},
		new Regin
		{
			Id = 8,
			Name = "a双滦区",
			ParentId = 6
		}
	};

	var tree = regions.ToTreeOrderBy<Regin, long, string>(x => x.Name).ToList();

	tree.First().Name.ShouldBe("a河北");
	tree.First().Children.First().Name.ShouldBe("a承德");
	tree.First().Children.First().Children.First().Name.ShouldBe("a双滦区");
}

CodeGenerate supports configuring Code length.

13 Apr 01:19
Compare
Choose a tag to compare
[Fact]
public void Test_CreateCode_With_Length()
{
	var generate = new GeneralTreeCodeGenerate(new GeneralTreeCodeGenerateConfiguration()
	{
		CodeLength = 3
	});

	generate.CreateCode().ShouldBe(null);
	generate.CreateCode(42).ShouldBe("042");
	generate.CreateCode(1, 2).ShouldBe("001.002");
	generate.CreateCode(1, 2, 3).ShouldBe("001.002.003");
}

fix MoveAsync parentId null bug.

12 Apr 13:14
Compare
Choose a tag to compare
2.2.9

Release v2.2.9

add CheckSameNameExpression for special situations.

21 Mar 07:07
Compare
Choose a tag to compare
[Fact]
public async Task CheckSameNameExpression_Test()
{
	var uowManager = LocalIocManager.Resolve<IUnitOfWorkManager>();

	using (var uow = uowManager.Begin()) {
		var repository = LocalIocManager.Resolve<IRepository<Region, long>>();
		var config = new GeneralTreeConfiguration<Region, long>
		{
			CheckSameNameExpression = (regionThis, regionCheck) =>
				regionThis.SomeForeignKey == regionCheck.SomeForeignKey
		};

		var manager =
			new GeneralTreeManager<Region, long>(repository, config);

		//Act
		await manager.CreateAsync(new Region
		{
			Name = "beijing",
			SomeForeignKey = 1
		});
		uowManager.Current.SaveChanges();

		//Act
		await manager.CreateAsync(new Region
		{
			Name = "beijing",
			SomeForeignKey = 2
		});
		uowManager.Current.SaveChanges();

		//Assert
		var beijing1 = repository.FirstOrDefault(x => x.Name == "beijing" && x.SomeForeignKey == 1);
		beijing1.ShouldNotBeNull();

		var beijing2 = repository.FirstOrDefault(x => x.Name == "beijing" && x.SomeForeignKey == 2);
		beijing2.ShouldNotBeNull();

		uow.Complete();
	}
}