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

set application name in connection string #28

Closed

Conversation

marek011
Copy link

@marek011 marek011 commented Feb 6, 2025

Set application name in connection string if connection string does not already contain application name parameter.

{
var builder = new SqlConnectionStringBuilder(connectionString);

if (string.IsNullOrEmpty(builder.ApplicationName) && !string.IsNullOrEmpty(applicationName))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ja by som tú podmienku dal na začiatku. Načo parsovať a vytvárať SqlConnectionStringBuilder, keď vlastne sa to vôbec možno nepoužije?

@marek011
Copy link
Author

marek011 commented Feb 18, 2025

Pull request uzatváram. Riešenie v PR nie je dobré, pretože application name by sa pridal do connection stringu len v prípade, že korm databáza sa konfiguruje pomocou extension metódy

public static KormBuilder AddKorm(this IServiceCollection services, IConfiguration configuration, string name)
, v ktorej sa volá metóda GetKormConnectionString. Korm databáza sa dá nakonfigurovať aj pomocou iných extension metód, prípadne úplne bez použitia extension metód z Kros.KORM.Extensions.Asp. Pridanie názvu aplikácie by sa teda malo robiť priamo v Kros.Korm knižnici kde sa používa connection string z KormConnectionSettings.

@marek011 marek011 closed this Feb 18, 2025
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

Successfully merging this pull request may close these issues.

2 participants