Skip to content

Conversation

@I3undy
Copy link
Contributor

@I3undy I3undy commented Dec 2, 2025

Fixes #8862.

…or tenants that are not using Microsoft SQL Server as their database provider
Comment on lines +14 to +23
/// <summary>
/// Prevents the SQL Server Service Broker feature from being enabled for tenants that are not using
/// Microsoft SQL Server as their database provider.
/// </summary>
/// <remarks>
/// The implementation is hackish but there seems to be no other way: if it would use <see cref="Orchard.UI.Notify.INotifier"/>
/// it wouldn't work since <see cref="Orchard.UI.Notify.NotifyFilter"/> that writes out notifications to TempData
/// runs before feature events are raised. Thus we have to manually add the messages to TempData, just as the filter
/// would do.
/// </remarks>
Copy link
Member

Choose a reason for hiding this comment

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

Namespace and rewrap:

Suggested change
/// <summary>
/// Prevents the SQL Server Service Broker feature from being enabled for tenants that are not using
/// Microsoft SQL Server as their database provider.
/// </summary>
/// <remarks>
/// The implementation is hackish but there seems to be no other way: if it would use <see cref="Orchard.UI.Notify.INotifier"/>
/// it wouldn't work since <see cref="Orchard.UI.Notify.NotifyFilter"/> that writes out notifications to TempData
/// runs before feature events are raised. Thus we have to manually add the messages to TempData, just as the filter
/// would do.
/// </remarks>
/// <summary>
/// Prevents the SQL Server Service Broker feature from being enabled for tenants that are not using Microsoft SQL
/// Server as their database provider.
/// </summary>
/// <remarks>
/// The implementation is hackish but there seems to be no other way: if it would use <see cref="INotifier"/> it
/// wouldn't work since <see cref="NotifyFilter"/> that writes out notifications to TempData runs before feature
/// events are raised. Thus we have to manually add the messages to TempData, just as the filter would do.
/// </remarks>


public void Uninstalling(Feature feature) { }


Copy link
Member

Choose a reason for hiding this comment

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

Suggested change

Comment on lines +73 to +75
AddNotification(
T("The SQL Server Service Broker cannot be enabled because it requires Microsoft SQL Server."),
NotifyType.Error);
Copy link
Member

Choose a reason for hiding this comment

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

Can you please check if you see the same behavior: When enabling SqlServerServiceBroker while Orchard.MessageBus is also disabled, then the notification will not be displayed. If I disable SqlServerServiceBroker and then enable it again (and thus Orchard.MessageBus is already enabled) then the notification is displayed.


public void Installed(Feature feature) { }

public void Enabling(Feature feature) { }
Copy link
Member

Choose a reason for hiding this comment

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

Please check if we can store here whether SqlServerServiceBroker's dependencies (there's only Orchard.MessageBus, but don't wire that in) are already enabled or not. Those that aren't should also be disabled along with SqlServerServiceBroker in the Enabled handler.

Comment on lines +95 to +100
notifyType.ToString() +
":" +
message.Text +
System.Environment.NewLine +
"-" +
System.Environment.NewLine;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
notifyType.ToString() +
":" +
message.Text +
System.Environment.NewLine +
"-" +
System.Environment.NewLine;
$"{notifyType}:{message.Text}{System.Environment.NewLine}-{System.Environment.NewLine}";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQL Server Service Broker breaks the app when enabled with port parameter in the connection string

2 participants