forked from ravendb/demo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[server] add conference mode setting and get user database name based…
… on it
- Loading branch information
Tomasz Opalach
committed
Jan 3, 2019
1 parent
9d9fb7c
commit 9b0b1a8
Showing
9 changed files
with
43 additions
and
19 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,23 @@ | ||
using System; | ||
using DemoCommon.Models; | ||
|
||
namespace DemoCommon.Utils.Database | ||
{ | ||
public static class DatabaseName | ||
public class DatabaseName | ||
{ | ||
private readonly DatabaseSettings _databaseSettings; | ||
private readonly bool _conferenceMode; | ||
|
||
public DatabaseName(DatabaseSettings databaseSettings, bool conferenceMode) | ||
{ | ||
_databaseSettings = databaseSettings; | ||
_conferenceMode = conferenceMode; | ||
} | ||
|
||
public const string UserDatabasePrefix = "User-"; | ||
|
||
public static string For(Guid userId) => $"{UserDatabasePrefix}{userId.ToString()}"; | ||
public string For(Guid userId) => _conferenceMode | ||
? _databaseSettings.Name | ||
: $"{UserDatabasePrefix}{userId.ToString()}"; | ||
} | ||
} |
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"Database": { | ||
"Urls": [ "http://localhost:8080" ], | ||
"Name": "Demo" | ||
} | ||
"Name": "Demo" | ||
}, | ||
"ConferenceMode": false | ||
} |