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


C# Book.Save方法代码示例

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


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

示例1: Main

        static void Main(string[] args)
        {
            Book book = new Book() { Id = 1, Title = "Book 1", Author = "Author 1" };
            book.Save(book);

            Console.Read();
        }
开发者ID:fatkhanfauzi,项目名称:CSharp-SOLID-Principle-Examples,代码行数:7,代码来源:WrongExProgram.cs

示例2: CommitChanges

 public DataObjectOperationResult CommitChanges(BookFormModel postedData)
 {
     Mapper.CreateMap<BookFormModel, Book>();
     var book = new Book(Db);
     Mapper.Map<BookFormModel, Book>(postedData, book);
     var results = book.Save();
     postedData.Id = book.Id;
     return results;
 }
开发者ID:sympletech,项目名称:RavenDesk,代码行数:9,代码来源:BookWorker.cs

示例3: TestSaveFromBelongsTo2

        public void TestSaveFromBelongsTo2()
        {
            var c = new Category { Name = "test" };
            var b1 = new Book { Name = "123" };
            var b2 = new Book { Name = "456" };
            var b3 = new Book { Name = "789" };
            b1.CurCategory.Value = c;
            b2.CurCategory.Value = c;
            b3.CurCategory.Value = c;
            b3.Save();

            var c1 = Category.FindById(c.Id);
            Assert.IsNotNull(c1);
            Assert.AreEqual("test", c1.Name);
            Assert.AreEqual(3, c1.Books.Count);
            Assert.AreEqual("123", c1.Books[0].Name);
            Assert.AreEqual("456", c1.Books[1].Name);
            Assert.AreEqual("789", c1.Books[2].Name);
        }
开发者ID:991899783,项目名称:DbEntry,代码行数:19,代码来源:HasManyAssociateTest.cs

示例4: TestSaveFromBelongsTo1

        public void TestSaveFromBelongsTo1()
        {
            var c = new Category { Name = "test" };
            var b1 = new Book { Name = "123" };
            var b2 = new Book { Name = "456" };
            c.Books.Add(b1);
            c.Books.Add(b2);
            b2.Save();

            var c1 = Category.FindById(c.Id);
            Assert.IsNotNull(c1);
            Assert.AreEqual("test", c1.Name);
            Assert.AreEqual(2, c1.Books.Count);
            Assert.AreEqual("123", c1.Books[0].Name);
            Assert.AreEqual("456", c1.Books[1].Name);
        }
开发者ID:991899783,项目名称:DbEntry,代码行数:16,代码来源:HasManyAssociateTest.cs


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