-
Notifications
You must be signed in to change notification settings - Fork 6
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
Named connection strings - using standard ConnectionStrings section in appsettings.json #6
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
I have one question: How do I add another connection string with a different credential for migration?
/// </summary> | ||
/// <param name="factory">Database factory.</param> | ||
/// <returns>Database instance.</returns> | ||
public static IDatabase GetDatabase(this IDatabaseFactory factory) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this method is like extension method and not directly in interface?
|
||
services.AddKorm("server=localhost-1", "db1"); | ||
services.AddKorm("server=localhost-2"); | ||
services.AddKorm("server=localhost-3", "db3"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this connection string with name db3
is added? It is not used.
action.Should().Throw<ArgumentException>().And.ParamName.Should().Be("name"); | ||
} | ||
|
||
[Fact] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add one test to verify that IDatabase
instance is disposed after the scope ended.
throw new ArgumentException(string.Format(Resources.DuplicateDatabaseName, name), nameof(name)); | ||
} | ||
builders.Add(name, builder); | ||
return builders.Count == 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very confusing for me. When the method Add..
returns a boolean, I assume that return true
is if item added successfully. I looked at it for a long time, as long as I understood.
Closes #4