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

configurable user collection #27

Merged
merged 4 commits into from
Dec 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}\\samples\\IdentitySample.Mvc\\bin\\Debug\\netcoreapp1.0\\IdentitySample.Mvc.dll",
"args": [],
"cwd": "${workspaceRoot}\\samples\\IdentitySample.Mvc",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart",
"launchBrowser": {
"enabled": true,
"args": "${auto-detect-url}",
"windows": {
"command": "cmd.exe",
"args": "/C start ${auto-detect-url}"
},
"osx": {
"command": "open"
},
"linux": {
"command": "xdg-open"
}
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceRoot}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command.pickProcess}"
}
]
}
16 changes: 16 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [
"${workspaceRoot}\\samples\\IdentitySample.Mvc\\project.json"
],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
}
]
}
6 changes: 3 additions & 3 deletions samples/IdentitySample.Mvc/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public Startup(IHostingEnvironment env)
{
// Set up configuration sources.
var builder = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json")
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);

if (env.IsDevelopment())
if (env.IsDevelopment() )
{
// For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
builder.AddUserSecrets();
builder.AddUserSecrets("userSecretsId"); // https://github.com/aspnet/UserSecrets/issues/62
}

builder.AddEnvironmentVariables();
Expand Down
3 changes: 2 additions & 1 deletion samples/IdentitySample.Mvc/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
"preserveCompilationContext": true,
"debugType": "portable"
},
"frameworks": {
"netcoreapp1.0": {
Expand Down
8 changes: 6 additions & 2 deletions src/AspNetCore.Identity.MongoDB/MongoUserStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ static MongoUserStore()
MongoConfig.EnsureConfigured();
}

public MongoUserStore(IMongoDatabase database, ILoggerFactory loggerFactory)
public MongoUserStore(IMongoDatabase database, ILoggerFactory loggerFactory)
: this (database, loggerFactory, "users")
{ }

public MongoUserStore(IMongoDatabase database, ILoggerFactory loggerFactory, string userCollectionName)
{
if(database == null)
{
Expand All @@ -47,7 +51,7 @@ public MongoUserStore(IMongoDatabase database, ILoggerFactory loggerFactory)
throw new ArgumentNullException(nameof(loggerFactory));
}

_usersCollection = database.GetCollection<TUser>("users");
_usersCollection = database.GetCollection<TUser>(userCollectionName);
_logger = loggerFactory.CreateLogger(GetType().Name);

EnsureIndicesCreatedAsync().GetAwaiter().GetResult();
Expand Down
3 changes: 3 additions & 0 deletions src/AspNetCore.Identity.MongoDB/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
"frameworks": {
"net451": { },
"netstandard1.5": { "imports": "dnxcore50" }
},
"buildOptions": {
"debugType": "portable"
}
}