Last active
December 11, 2015 05:29
-
-
Save felipeleusin/4552842 to your computer and use it in GitHub Desktop.
Raven AsyncDocumentSession not generating Id after calling Store. [Update]
In case anyone stumbles here apparently, this by design as replied in this issue: http://issues.hibernatingrhinos.com/issue/RavenDB-834
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Raven.Tests.Helpers; | |
using Xunit; | |
namespace Raven.Tests | |
{ | |
public class User | |
{ | |
public string Id { get; set; } | |
public string Name { get; set; } | |
} | |
public class AsyncSessionTests : RavenTestBase | |
{ | |
[Fact] | |
public async Task CannotGenerateIdAfterStoreOnlyAfterSaveChanges() | |
{ | |
using (var store = NewDocumentStore()) | |
{ | |
using (var session = store.OpenAsyncSession()) | |
{ | |
var user = new User() {Name = "fulano"}; | |
session.Store(user); | |
Assert.NotNull(user.Id); | |
await session.SaveChangesAsync(); | |
} | |
using (var session = store.OpenAsyncSession()) | |
{ | |
var user = await session.LoadAsync<User>(1); | |
Assert.NotNull(user); | |
Assert.Equal(user.Id, "users/1"); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment