Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Items to complete for V2 #14

Open
jsheely opened this issue Apr 7, 2014 · 4 comments
Open

Items to complete for V2 #14

jsheely opened this issue Apr 7, 2014 · 4 comments

Comments

@jsheely
Copy link
Contributor

jsheely commented Apr 7, 2014

Right now the major items left for v2 are

  • User which allows user to specific the type for the Id field. int,string,guid, etc. Since we currently use ObjectId it makes the ObjectId.Parse() feature difficult. This feature may get removed for the MongoDB implementation.
  • RoleStore - In this version I will be implementing IdentityRole which requires a backing store to handle the data instead of saving Roles in an non-normalized string array.
  • Testing
@jsheely jsheely changed the title Items to complete Items to complete for V2 Apr 7, 2014
@eshkard
Copy link

eshkard commented Apr 7, 2014

In order to set string as object id
[BsonRepresentation(BsonType.ObjectId)]
public virtual string Id { get; set; }

@jsheely
Copy link
Contributor Author

jsheely commented Apr 7, 2014

Yup. That's how it works now. However the spec for AspNet.Identity v2 allows you to set the type for the primary key (int,string,guid,etc). As shown on the IdentityUser model as

public virtual TKey Id {get;set;}

So in order to honor that contract I need to refactor the fetching functions to understand TKey when doing a mongo Query() operation. Right now it utilizes ObjectId.Parse() which only accepts a string not a TKey.

@mbeckenbach
Copy link

I'm quite new in the mongodb area. But wouldnt it be possible to create two keys? One that is a real object id and has only a private setter, so you can't mess with it. And second unique property which represents the identity framework user id.

´´´
[BsonRepresentation(BsonType.ObjectId)]
public virtual string BsonId { get; private set; }

// This would be the unique identifier identity framework expects
public virtual Id { get; set; }
´´´

As far as i understand this, the only thing you'd need to do for that is to check if there is another object with the same value in Id when creating a new user, so that it can be used as a unique key.

@ed-sparkes
Copy link

Hi, is this still being actively developed? Would love to be able to use my username field as the ApplicationUser Document id.
Thanks, Ed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants