-
Notifications
You must be signed in to change notification settings - Fork 316
FIX | db_id returns null on Azure SQL Database. #1294
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,11 +138,20 @@ internal SqlConnectionContainer(SqlConnectionContainerHashHelper hashHelper, str | |
| _appDomainKeyHash = new Dictionary<string, int>(); // Dictionary stores the Start/Stop refcount per AppDomain for this container. | ||
| _com = new SqlCommand(); | ||
| _com.Connection = _con; | ||
| bool? dbId = null; | ||
|
|
||
| // SQL BU DT 391534 - determine if broker is enabled on current database. | ||
| _com.CommandText = "select is_broker_enabled from sys.databases where database_id=db_id()"; | ||
|
|
||
| if (!(bool)_com.ExecuteScalar()) | ||
| // db_id() returns the database ID of the current database hence it will always be one line result | ||
| using SqlDataReader reader = _com.ExecuteReader(CommandBehavior.SingleRow); | ||
| if (reader.Read() && reader[0] is not null) | ||
| { | ||
| dbId = reader.GetBoolean(0); | ||
| } | ||
| reader.Close(); | ||
|
|
||
| if (dbId is null || !dbId.Value) | ||
|
||
| { | ||
| throw SQL.SqlDependencyDatabaseBrokerDisabled(); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.