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


C# IDbConnection.InsertAll方法代码示例

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


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

示例1: TestFixtureSetUp

        public void TestFixtureSetUp()
        {
            db = base.OpenDbConnection();

            db.DropAndCreateTable<Person>();
            db.InsertAll(Person.Rockstars);
        }
开发者ID:wrx362114,项目名称:ServiceStack.OrmLite,代码行数:7,代码来源:MockAllApiTests.cs

示例2: Init

        public void Init(IDbConnection db)
        {
            db.DropAndCreateTable<Person>();
            db.DropAndCreateTable<Band>();

            db.InsertAll(Person.Rockstars);

            db.Insert(new Band { Name = "The Doors", PersonId = 3 });
            db.Insert(new Band { Name = "Nirvana", PersonId = 4 });
        }
开发者ID:JohnKlippenstein-AI,项目名称:ServiceStack.OrmLite,代码行数:10,代码来源:FromExpressionTests.cs

示例3: Seed

        private void Seed(IDbConnection db)
        {
            SeedFolders = new List<Folder>
            {
                new Folder {Id = 1, Name = "Wisconsin", ParentFolderId = null},
                new Folder {Id = 2, Name = "Dane County", ParentFolderId = 1}
            };

            SeedPages = new List<Page>
            {
                new Page {Id = 1, FolderId = 1, Title = "WI Base Page 1"},
                new Page {Id = 2, FolderId = 1, Title = "WI Base Page 2"},
                new Page {Id = 3, FolderId = 2, Title = "Belleville, WI"},
                new Page {Id = 4, FolderId = 2, Title = "Madison, WI"}
            };
            db.InsertAll(SeedFolders);
            db.InsertAll(SeedPages);
            var page1 = new Page {FolderId = 2, Title = "Page with Links"};
            var pageId = (int)db.Insert(page1, true);
            page1.Id = pageId;

            var page2 = new Page {FolderId = 1, Title = "Page With Links in Folder 1"};
            var secondPageId = (int)db.Insert(page2, true);
            page2.Id = secondPageId;

            SeedPages.Add(page1);
            SeedPages.Add(page2);

            SeedLinks = new List<Link>
            {
                new Link {Id = 1, IsLink = true, PageId = pageId, Position = 1, Title= "Test Link 1", Url= "http://www.jetnett.com"},
                new Link {Id = 2, IsLink = true, PageId = pageId, Position = 2, Title= "Test Link 2", Url= "http://www.jetnett.com"},
                new Link {Id = 3, IsLink = true, PageId = pageId, Position = 3, Title= "Test Link 3", Url= "http://www.jetnett.com"},
                new Link {Id = 4, IsLink = true, PageId = pageId, Position = 4, Title= "Test Link 4", Url= "http://www.jetnett.com"},
                new Link {Id = 5, IsLink = true, PageId = pageId, Position = 5, Title= "Test Link 5", Url= "http://www.kylegobel.com"},
                new Link {Id = 6, IsLink = true, PageId = pageId, Position = 6, Title= "Test Link 6", Url= "http://www.jetnett.com"},
                new Link {Id = 7, IsLink = true, PageId = secondPageId, Position = 1, Title= "Test Link 1", Url= "http://www.jetnett.com"},
                new Link {Id = 8, IsLink = true, PageId = secondPageId, Position = 2, Title= "Test Link 2", Url= "http://www.jetnett.com"},
                new Link {Id = 9, IsLink = true, PageId = secondPageId, Position = 3, Title= "Test Link 3", Url= "http://www.jetnett.com"},
                new Link {Id = 10, IsLink = true, PageId = secondPageId, Position = 4, Title= "Test Link 4", Url= "http://www.jetnett.com"},
                new Link {Id = 11, IsLink = true, PageId = secondPageId, Position = 5, Title= "Test Link 5", Url= "http://www.jetnett.com"},
            };

            db.InsertAll(SeedLinks);
        }
开发者ID:KyleGobel,项目名称:ServiceStackJetNettApi,代码行数:45,代码来源:TestDb.cs


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