Skip to content

Commit

Permalink
Merge pull request #27 from SorenZ/master
Browse files Browse the repository at this point in the history
configurable user collection
  • Loading branch information
tugberkugurlu authored Dec 21, 2016
2 parents 3c440f5 + bb3e050 commit 0657852
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 6 deletions.
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"
}
}

0 comments on commit 0657852

Please sign in to comment.