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


C# IAsyncDocumentSession.SaveChangesAsync方法代码示例

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


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

示例1: ExecuteAsync

        public async override Task<HttpResponseMessage> ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken) {
            using (Session = Store.OpenAsyncSession()) {
                var result = await base.ExecuteAsync(controllerContext, cancellationToken);
                await Session.SaveChangesAsync();

                return result;
            }
        }
开发者ID:leveragesystems,项目名称:leverage_api,代码行数:8,代码来源:RavenDbController.cs

示例2: SaveEntities

        protected static async Task SaveEntities(IEnumerable<IEntity> entities, IAsyncDocumentSession session)
        {
            foreach (var entity in entities)
            {
                await session.StoreAsync(entity);
            }

            await session.SaveChangesAsync();
        }
开发者ID:jeremy-holt,项目名称:Cornhouse.Factory-Mutran,代码行数:9,代码来源:UnitTestBase.cs

示例3: EnsureSubscriptionsExists

 private async Task EnsureSubscriptionsExists(IAsyncDocumentSession session)
 {
     var subscription = await session.LoadAsync<Subscription>(Subscription.Id);
     if (subscription == null)
     {
         subscription = new Subscription();
         await session.StoreAsync(subscription);
         await session.SaveChangesAsync();
     }
 }
开发者ID:nls75,项目名称:Rebus,代码行数:10,代码来源:RavenDbSubscriptionStorage.cs

示例4: Index

        public async Task<ActionResult> Index(IAsyncDocumentSession asyncSession)
        {
            // Remove when MVC 4 is released (http://forums.asp.net/p/1778103/4880898.aspx/1?Re+Using+an+Async+Action+to+Run+Synchronous+Code)
            await Task.Yield();

            var mike = (await asyncSession.Query<User>().Take(1).ToListAsync()).FirstOrDefault();
            if (mike == null)
            {
                mike = new User {FirstName = "Mike", LastName = "Noonan"};
                asyncSession.Store(mike);
                await asyncSession.SaveChangesAsync();
            }
            if (mike.F1AccessToken == null || mike.PCOAccessToken == null)
            {
                return RedirectToAction("Authenticate", "F1Auth");
            }

            return View();
        }
开发者ID:highwaychurch,项目名称:web,代码行数:19,代码来源:HomeController.cs

示例5: CreateDefaultData

        private static void CreateDefaultData(IAsyncDocumentSession session)
        {
            var role = new ApplicationRole("Admin");
            session.StoreAsync(role);

            var hasher = new PasswordHasher();
            var passwordHash = hasher.HashPassword("admin");
            var superUser = new ApplicationUser("SuperAdmin")
            {
                Email = "[email protected]",
                FirstName = "Super",
                LastName = "Admin",
                UserName = "superadmin",
                PasswordHash = passwordHash,
                EmailConfirmed = true,
                Roles = {"Admin"}
            };

            session.StoreAsync(superUser);

            session.SaveChangesAsync();
        }
开发者ID:jeremy-holt,项目名称:Cornhouse.Factory-Mutran,代码行数:22,代码来源:InitializeRavenDb.cs

示例6: SaveEntity

 protected static async Task SaveEntity(IEntity entity, IAsyncDocumentSession session)
 {
     await session.StoreAsync(entity);
     await session.SaveChangesAsync();
 }
开发者ID:jeremy-holt,项目名称:Cornhouse.Factory-Mutran,代码行数:5,代码来源:UnitTestBase.cs

示例7: Save

 public void Save(IAsyncDocumentSession session, Action<object> callback)
 {
     session.Store(jsonDocument);
     session.SaveChangesAsync();
     Id = jsonDocument.Key;
 }
开发者ID:andrewdavey,项目名称:ravendb,代码行数:6,代码来源:Document.cs

示例8: StoreDataAsync

        public async Task StoreDataAsync(DocumentStore store, IAsyncDocumentSession session)
        {
			for (var i = 1; i <= Cntr; i++)
           {
				await session.StoreAsync(new User {Name = "Test User #" + i}, "users/" + i);
           }
            await session.SaveChangesAsync();
        }
开发者ID:WimVergouwe,项目名称:ravendb,代码行数:8,代码来源:RavenDb1962.cs

示例9: AddUsers

 // privates
 private static async Task AddUsers(IAsyncDocumentSession ses)
 {
     await ses.StoreAsync(new RavenUser { UserName = "Tugberk", Roles = new List<RavenUserRole> { new RavenUserRole { Id = "Admin" }, new RavenUserRole { Id = "Guest" } } });
     await ses.StoreAsync(new RavenUser { UserName = "Tugberk2", Roles = new List<RavenUserRole> { new RavenUserRole { Id = "Admin" } } });
     await ses.StoreAsync(new RavenUser { UserName = "Tugberk2", Roles = new List<RavenUserRole> { new RavenUserRole { Id = "Guest" } } });
     await ses.SaveChangesAsync();
 }
开发者ID:andrewm1986,项目名称:AspNet.Identity.RavenDB,代码行数:8,代码来源:RavenRoleStoreFacts.cs


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