当前位置: 首页>>代码示例>>C#>>正文


C# Root.Save方法代码示例

本文整理汇总了C#中Root.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Root.Save方法的具体用法?C# Root.Save怎么用?C# Root.Save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Root的用法示例。


在下文中一共展示了Root.Save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateAndDeleteChild

        public void CreateAndDeleteChild()
        {
            Root root = new Root();

              root.Child.DeleteChild();
              Assert.IsTrue(root.Child.IsDeleted, "Child should be marked for deletion");
              Assert.IsTrue(root.Child.IsDirty, "Child should be dirty");

              root = root.Save();

              Assert.IsTrue(root.IsDirty, "Root should be dirty after Save");
              Assert.IsFalse(root.IsNew, "Root should not be new");
              Assert.IsTrue(root.Child.IsDirty, "Child should be dirty");
              Assert.IsTrue(root.Child.IsNew, "Child should be new");
              Assert.AreEqual("Created", root.Child.Status, "Child status incorrect");
        }
开发者ID:Jaans,项目名称:csla,代码行数:16,代码来源:DataPortalChildTests.cs

示例2: CreateAndSaveChild

        public void CreateAndSaveChild()
        {
            Root root = new Root();
              root.Data = "a";
              root.Child.Data = "b";

              Assert.IsTrue(root.IsDirty, "Root should be dirty");
              Assert.IsTrue(root.Child.IsNew, "Child should be new");
              Assert.IsTrue(root.Child.IsDirty, "Child should be dirty");
              Assert.AreEqual("Created", root.Child.Status, "Child status incorrect after create");

              root = root.Save();

              Assert.IsFalse(root.IsDirty, "Root should not be dirty");
              Assert.IsFalse(root.IsNew, "Root should not be new");
              Assert.IsFalse(root.Child.IsDirty, "Child should not be dirty");
              Assert.IsFalse(root.Child.IsNew, "Child should not be new");
              Assert.AreEqual("Inserted", root.Child.Status, "Child status incorrect after Save");
        }
开发者ID:Jaans,项目名称:csla,代码行数:19,代码来源:DataPortalChildTests.cs

示例3: FetchAndSaveChild

    public void FetchAndSaveChild()
    {
      Root root = new Root();
      root.FetchChild();

      Assert.IsFalse(root.Child.IsNew, "Child should not be new");
      Assert.IsFalse(root.Child.IsDirty, "Child should not be dirty");
      Assert.AreEqual("Fetched", root.Child.Status, "Child status incorrect after fetch");

      root.Child.Data = "b";

      Assert.IsTrue(root.Child.IsDirty, "Child should be dirty");

      root = root.Save();

      Assert.IsFalse(root.IsDirty, "Root should not be dirty");
      Assert.IsFalse(root.IsNew, "Root should not be new");
      Assert.IsFalse(root.Child.IsDirty, "Child should not be dirty");
      Assert.IsFalse(root.Child.IsNew, "Child should not be new");
      Assert.AreEqual("Updated", root.Child.Status, "Child status incorrect after Save");
    }
开发者ID:nschonni,项目名称:csla-svn,代码行数:21,代码来源:DataPortalChildTests.cs

示例4: FetchAndSaveChildListVerifyParent

        public void FetchAndSaveChildListVerifyParent()
        {
            Root root = new Root();
              root.Data = "root";
              var oneChild = root.Child;
              oneChild.Data = "random";

              var list = root.ChildList;
              Assert.IsFalse(root.ChildList.IsDirty, "Child list should not be dirty");
              Assert.AreEqual("Fetched", root.ChildList.Status, "Child list status incorrect after fetch");

              list.Add(Child.NewChild());

              Assert.IsTrue(root.ChildList.IsDirty, "Child list should be dirty after add");
              Assert.IsTrue(root.ChildList[0].IsDirty, "Child should be dirty after add");
              Assert.IsTrue(root.ChildList[0].IsNew, "Child should be new after add");

              root = root.Save();

              Assert.IsFalse(root.IsDirty, "Root should not be dirty after Save");
              Assert.IsFalse(root.IsNew, "Root should not be new");
              Assert.IsFalse(root.ChildList.IsDirty, "Child should not be dirty after Save");
              Assert.AreEqual("Updated", root.ChildList.Status, "Child list status incorrect after Save");
              Assert.IsFalse(root.ChildList[0].IsDirty, "Child should not be dirty after Save");
              Assert.IsFalse(root.ChildList[0].IsNew, "Child should not be new after Save");
              Assert.AreEqual("Inserted", root.ChildList[0].Status, "Child status incorrect after Save");

              Assert.AreEqual("root", root.ChildList[0].RootData, "Parent data is not correct after Save in the list");
              Assert.AreEqual("root", root.Child.RootData, "Parent data is not correct after Save in one child");
        }
开发者ID:Jaans,项目名称:csla,代码行数:30,代码来源:DataPortalChildTests.cs

示例5: FetchAndSaveChildList

        public void FetchAndSaveChildList()
        {
            Root root = new Root();
              var list = root.ChildList;
              Assert.IsFalse(root.ChildList.IsDirty, "Child list should not be dirty");
              Assert.AreEqual("Fetched", root.ChildList.Status, "Child list status incorrect after fetch");

              list.Add(Child.NewChild());

              Assert.IsTrue(root.ChildList.IsDirty, "Child list should be dirty after add");
              Assert.IsTrue(root.ChildList[0].IsDirty, "Child should be dirty after add");
              Assert.IsTrue(root.ChildList[0].IsNew, "Child should be new after add");

              root = root.Save();

              Assert.IsFalse(root.IsDirty, "Root should not be dirty after Save");
              Assert.IsFalse(root.IsNew, "Root should not be new");
              Assert.IsFalse(root.ChildList.IsDirty, "Child should not be dirty after Save");
              Assert.AreEqual("Updated", root.ChildList.Status, "Child list status incorrect after Save");
              Assert.IsFalse(root.ChildList[0].IsDirty, "Child should not be dirty after Save");
              Assert.IsFalse(root.ChildList[0].IsNew, "Child should not be new after Save");
              Assert.AreEqual("Inserted", root.ChildList[0].Status, "Child status incorrect after Save");
        }
开发者ID:Jaans,项目名称:csla,代码行数:23,代码来源:DataPortalChildTests.cs


注:本文中的Root.Save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。