Skip to content

Commit

Permalink
Merge pull request #57 from couchbaselabs/change-primary-key
Browse files Browse the repository at this point in the history
Change primary from guid to natural key
  • Loading branch information
jeffrymorris committed Aug 21, 2018
2 parents d7fa431 + cf652eb commit 1499e56
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Couchbase.Extensions.Identity/IdentityUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace Couchbase.Extensions.Identity
[DocumentTypeFilter("identityuser")]
public class IdentityUser
{
public IdentityUser()
public IdentityUser()
{
Roles = new List<string>();
Logins = new List<IdentityUserLogin>();
Expand Down
2 changes: 1 addition & 1 deletion src/Couchbase.Extensions.Identity/RoleStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task<IdentityResult> CreateAsync(TRole role, CancellationToken canc

if (role.Id == null)
{
role.Id = Guid.NewGuid().ToString();
role.Id = role.NormalizedName;
}
var result = await _context.Bucket.InsertAsync(role.Id, role).ConfigureAwait(false);
if (result.Success)
Expand Down
3 changes: 2 additions & 1 deletion src/Couchbase.Extensions.Identity/UserStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ public async Task<IdentityResult> CreateAsync(TUser user, CancellationToken canc
{
throw new ArgumentNullException(nameof(user));
}

if (user.Id == null)
{
user.Id = Guid.NewGuid().ToString();
user.Id = user.NormalizedUserName;
}
var result = await _context.Bucket.InsertAsync(user.Id, user).ConfigureAwait(false);
if (result.Success)
Expand Down

0 comments on commit 1499e56

Please sign in to comment.