예제 #1
0
        public void SaveCycle()
        {
            using (Transaction tr = new Transaction())
                using (OperationLogic.AllowSave <ArtistEntity>())
                {
                    ArtistEntity m = new ArtistEntity()
                    {
                        Name = "Michael"
                    };
                    ArtistEntity f = new ArtistEntity()
                    {
                        Name = "Frank"
                    };
                    m.Friends.Add(f.ToLiteFat());
                    f.Friends.Add(m.ToLiteFat());

                    Database.SaveParams(m, f);

                    var list = Database.Query <ArtistEntity>().Where(a => a == m || a == f).ToList();

                    Assert.IsTrue(list[0].Friends.Contains(list[1].ToLite()));
                    Assert.IsTrue(list[1].Friends.Contains(list[0].ToLite()));

                    //tr.Commit();
                }
        }
예제 #2
0
        public void SaveSelfCycle()
        {
            using (Transaction tr = new Transaction())
                using (OperationLogic.AllowSave <ArtistEntity>())
                {
                    ArtistEntity m = new ArtistEntity()
                    {
                        Name = "Michael"
                    };
                    m.Friends.Add(m.ToLiteFat());

                    m.Save();

                    var m2 = m.ToLite().RetrieveAndForget();

                    Assert.IsTrue(m2.Friends.Contains(m2.ToLite()));

                    //tr.Commit();
                }
        }