This project is read-only.
1

Closed

bug of save ActAsTree object with ManyToMany column

description

bug of save ActAsTree object with ManyToMany column.
Code:
[DbContext("SQLite")]
public class TreeInfo : DbObjectModelAsTree<TreeInfo>
{
public string Name { get; set; }

[HasAndBelongsToMany]
public IList<OtherInfo> Other { get; private set; }
}

[DbContext("SQLite")]
public class OtherInfo : DbObjectModel<OtherInfo>
{
public string Name { get; set; }

[HasAndBelongsToMany]
public IList<TreeInfo> Info { get; private set; }
}

[Test]
public void TestHasAndBelongsToManyWithAsTree()
{
StaticRecorder.ClearMessages();
var f1 = new TreeInfo { Name = "father" };
var s1 = new TreeInfo{Name = "son"};
f1.Children.Add(s1);
f1.Save();

var n = StaticRecorder.Messages.Count<string>(p => p.StartsWith("INSERT INTO [R_OtherInfo_TreeInfo]"));
Assert.AreEqual(0, n); // should be 0 but was 1
}
Closed Apr 2, 2015 at 10:40 AM by lifeng

comments

wrote Apr 2, 2015 at 10:35 AM

Fixed on changeset 107311

wrote Apr 2, 2015 at 10:40 AM