diff --git a/src/Umbraco.Core/Models/IServerRegistration.cs b/src/Umbraco.Core/Models/IServerRegistration.cs
index 58b8e46249..8053ea0a6e 100644
--- a/src/Umbraco.Core/Models/IServerRegistration.cs
+++ b/src/Umbraco.Core/Models/IServerRegistration.cs
@@ -18,12 +18,10 @@ namespace Umbraco.Core.Models
///
bool IsActive { get; set; }
- // note: cannot add this because of backward compatibility
- //
- /////
- ///// Gets or sets a value indicating whether the server is master.
- /////
- //bool IsMaster { get; set; }
+ ///
+ /// Gets or sets a value indicating whether the server is master.
+ ///
+ bool IsMaster { get; set; }
///
/// Gets the date and time the registration was created.
diff --git a/src/Umbraco.Core/Services/IServerRegistrationService.cs b/src/Umbraco.Core/Services/IServerRegistrationService.cs
index d581b86f15..cc40e09ceb 100644
--- a/src/Umbraco.Core/Services/IServerRegistrationService.cs
+++ b/src/Umbraco.Core/Services/IServerRegistrationService.cs
@@ -33,19 +33,15 @@ namespace Umbraco.Core.Services
/// All active servers.
IEnumerable GetActiveServers();
- // note: cannot add this because of backward compatibility
- //
- /////
- ///// Gets the current server identity.
- /////
- //string CurrentServerIdentity { get; }
+ ///
+ /// Gets the current server identity.
+ ///
+ string CurrentServerIdentity { get; }
- // note: cannot add this because of backward compatibility
- //
- /////
- ///// Gets the role of the current server.
- /////
- ///// The role of the current server.
- //ServerRole GetCurrentServerRole();
+ ///
+ /// Gets the role of the current server.
+ ///
+ /// The role of the current server.
+ ServerRole GetCurrentServerRole();
}
}
\ No newline at end of file
diff --git a/src/Umbraco.Core/Services/ServerRegistrationService.cs b/src/Umbraco.Core/Services/ServerRegistrationService.cs
index 81e6a39add..43329ebe5f 100644
--- a/src/Umbraco.Core/Services/ServerRegistrationService.cs
+++ b/src/Umbraco.Core/Services/ServerRegistrationService.cs
@@ -53,8 +53,7 @@ namespace Umbraco.Core.Services
{
var regs = xr.Repository.GetAll().ToArray(); // faster to query only once
var hasMaster = regs.Any(x => ((ServerRegistration)x).IsMaster);
- var iserver = regs.FirstOrDefault(x => x.ServerIdentity.InvariantEquals(serverIdentity));
- var server = iserver as ServerRegistration; // because IServerRegistration is missing IsMaster
+ var server = regs.FirstOrDefault(x => x.ServerIdentity.InvariantEquals(serverIdentity));
var hasServer = server != null;
if (server == null)
@@ -96,8 +95,7 @@ namespace Umbraco.Core.Services
_lrepo.WithWriteLocked(xr =>
{
var query = Query.Builder.Where(x => x.ServerIdentity.ToUpper() == serverIdentity.ToUpper());
- var iserver = xr.Repository.GetByQuery(query).FirstOrDefault();
- var server = iserver as ServerRegistration; // because IServerRegistration is missing IsMaster
+ var server = xr.Repository.GetByQuery(query).FirstOrDefault();
if (server == null) return;
server.IsActive = false;
diff --git a/src/Umbraco.Core/Sync/DatabaseServerRegistrar.cs b/src/Umbraco.Core/Sync/DatabaseServerRegistrar.cs
index 8ac40c1a51..666e2105db 100644
--- a/src/Umbraco.Core/Sync/DatabaseServerRegistrar.cs
+++ b/src/Umbraco.Core/Sync/DatabaseServerRegistrar.cs
@@ -43,7 +43,7 @@ namespace Umbraco.Core.Sync
///
public ServerRole GetCurrentServerRole()
{
- var service = _registrationService.Value as ServerRegistrationService;
+ var service = _registrationService.Value;
return service.GetCurrentServerRole();
}
diff --git a/src/Umbraco.Tests/ApplicationUrlHelperTests.cs b/src/Umbraco.Tests/ApplicationUrlHelperTests.cs
index 340467d07c..578a569104 100644
--- a/src/Umbraco.Tests/ApplicationUrlHelperTests.cs
+++ b/src/Umbraco.Tests/ApplicationUrlHelperTests.cs
@@ -57,6 +57,8 @@ namespace Umbraco.Tests
&& section.WebRouting == Mock.Of(wrSection => wrSection.UmbracoApplicationUrl == (string)null)
&& section.ScheduledTasks == Mock.Of());
+ ApplicationUrlHelper.ApplicationUrlProvider = request => "http://server1.com/umbraco";
+
Initialize(settings);
var appCtx = new ApplicationContext(CacheHelper.CreateDisabledCacheHelper(),
@@ -64,7 +66,6 @@ namespace Umbraco.Tests
ConfigurationManager.AppSettings.Set("umbracoUseSSL", "true"); // does not make a diff here
- ApplicationUrlHelper.ApplicationUrlProvider = request => "http://server1.com/umbraco";
ApplicationUrlHelper.EnsureApplicationUrl(appCtx, settings: settings);
Assert.AreEqual("http://server1.com/umbraco", appCtx._umbracoApplicationUrl);
diff --git a/src/Umbraco.Web/Strategies/ServerRegistrationEventHandler.cs b/src/Umbraco.Web/Strategies/ServerRegistrationEventHandler.cs
index b23c0870bc..2a61d4177d 100644
--- a/src/Umbraco.Web/Strategies/ServerRegistrationEventHandler.cs
+++ b/src/Umbraco.Web/Strategies/ServerRegistrationEventHandler.cs
@@ -75,7 +75,7 @@ namespace Umbraco.Web.Strategies
_lastUpdated = DateTime.Now;
}
- var svc = e.UmbracoContext.Application.Services.ServerRegistrationService as ServerRegistrationService;
+ var svc = e.UmbracoContext.Application.Services.ServerRegistrationService;
// because
// - ApplicationContext.UmbracoApplicationUrl is initialized by UmbracoModule in BeginRequest
diff --git a/src/Umbraco.Web/UI/LegacyDialogHandler.cs b/src/Umbraco.Web/UI/LegacyDialogHandler.cs
index 5ae7d0c627..dfa7fbc153 100644
--- a/src/Umbraco.Web/UI/LegacyDialogHandler.cs
+++ b/src/Umbraco.Web/UI/LegacyDialogHandler.cs
@@ -193,10 +193,18 @@ namespace Umbraco.Web.UI
typeInstance.Alias = text;
// check for returning url
- var returnUrlTask = typeInstance as LegacyDialogTask;
-
- returnUrlTask.AdditionalValues = additionalValues;
-
+ ITaskReturnUrl returnUrlTask = typeInstance as LegacyDialogTask;
+ if (returnUrlTask != null)
+ {
+ // if castable to LegacyDialogTask: add in additionalValues
+ ((LegacyDialogTask) returnUrlTask).AdditionalValues = additionalValues;
+ }
+ else
+ {
+ // otherwise cast to returnUrl interface
+ returnUrlTask = typeInstance as ITaskReturnUrl;
+ }
+
typeInstance.Save();
return returnUrlTask != null