partial void OnMySelfChanged(Self value);
Esempio n. 2
0
        public void Self()
        {
            int parentId;

            using (var db = new TrackerDataContext())
            {
                var parent = new Self {Name = "Parent"};
                db.Self.InsertOnSubmit(parent);
                db.SubmitChanges();

                parentId = parent.Id;

                var child = new Self {Name = "Child", MySelf = parent};
                db.Self.InsertOnSubmit(child);
                db.SubmitChanges();
            }

            using (var db = new TrackerDataContext())
            {
                var child = db.Self
                    .ByName("Child")
                    .FirstOrDefault();

                Assert.AreEqual(parentId, child.MySelf.Id);

                db.Self.DeleteOnSubmit(child);
                db.Self.DeleteOnSubmit(child.MySelf);
                db.SubmitChanges();
            }
        }
 partial void OnMySelfChanging(Self newValue, Self oldValue);