diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/create.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/create.aspx.cs
index 61e902acf7..5bfc61ff09 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/create.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/create.aspx.cs
@@ -31,7 +31,7 @@ namespace umbraco.dialogs
{
_app = Request.CleanForXss("app");
//validate the app
- if (BusinessLogic.Application.getAll().Any(x => x.alias.InvariantEquals(_app)) == false)
+ if (Services.SectionService.GetSections().Any(x => x.Alias.InvariantEquals(_app)) == false)
{
throw new InvalidOperationException("A requested app: " + Request.GetItemAsString("app") + " was not found");
}
diff --git a/src/umbraco.businesslogic/Application.cs b/src/umbraco.businesslogic/Application.cs
deleted file mode 100644
index a265703e65..0000000000
--- a/src/umbraco.businesslogic/Application.cs
+++ /dev/null
@@ -1,174 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Linq;
-using AutoMapper;
-using Umbraco.Core;
-using Umbraco.Core.Logging;
-using Umbraco.Core.Models;
-using umbraco.DataLayer;
-
-
-namespace umbraco.BusinessLogic
-{
- ///
- /// Class for handling all registered applications in Umbraco.
- ///
- [Obsolete("Use ApplicationContext.Current.Services.SectionService and/or Umbraco.Core.Sections.SectionCollection instead")]
- public class Application
- {
- private static ISqlHelper _sqlHelper;
-
-
-
- ///
- /// Gets the SQL helper.
- ///
- /// The SQL helper.
- [Obsolete("Do not use SqlHelper anymore, if database querying needs to be done use the DatabaseContext instead")]
- public static ISqlHelper SqlHelper
- {
- get
- {
- if (_sqlHelper == null)
- {
- var connectionString = string.Empty;
-
- try
- {
- const string umbracoDsn = Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName;
-
- var databaseSettings = ConfigurationManager.ConnectionStrings[umbracoDsn];
- if (databaseSettings != null)
- connectionString = databaseSettings.ConnectionString;
-
- // During upgrades we might still have the old appSettings connectionstring, and not the new one, so get that one instead
- if (string.IsNullOrWhiteSpace(connectionString) &&
- ConfigurationManager.AppSettings.ContainsKey(umbracoDsn))
- connectionString = ConfigurationManager.AppSettings[umbracoDsn];
-
- _sqlHelper = DataLayerHelper.CreateSqlHelper(connectionString, false);
- }
- catch(Exception ex)
- {
- LogHelper.Error(string.Format("Can't instantiate SQLHelper with connectionstring \"{0}\"", connectionString), ex);
- }
- }
-
- return _sqlHelper;
- }
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- public Application()
- { }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The application name.
- /// The application alias.
- /// The application icon.
- public Application(string name, string alias, string icon)
- : this(name, alias, icon, 0)
- { }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The name.
- /// The alias.
- /// The icon.
- /// The sort order.
- public Application(string name, string alias, string icon, int sortOrder)
- {
- this.name = name;
- this.alias = alias;
- this.icon = icon;
- this.sortOrder = sortOrder;
- }
-
- ///
- /// Gets or sets the application name.
- ///
- /// The name.
- public string name { get; set; }
-
- ///
- /// Gets or sets the application alias.
- ///
- /// The alias.
- public string alias { get; set; }
-
- ///
- /// Gets or sets the application icon.
- ///
- /// The application icon.
- public string icon { get; set; }
-
- ///
- /// Gets or sets the sort order.
- ///
- ///
- /// The sort order.
- ///
- public int sortOrder { get; set; }
-
- ///
- /// Creates a new applcation if no application with the specified alias is found.
- ///
- /// The application name.
- /// The application alias.
- /// The application icon, which has to be located in umbraco/images/tray folder.
- public static void MakeNew(string name, string alias, string icon)
- {
- ApplicationContext.Current.Services.SectionService.MakeNew(name, alias, icon);
- }
-
- ///
- /// Makes the new.
- ///
- /// The name.
- /// The alias.
- /// The icon.
- /// The sort order.
- public static void MakeNew(string name, string alias, string icon, int sortOrder)
- {
- ApplicationContext.Current.Services.SectionService.MakeNew(name, alias, icon, sortOrder);
- }
-
- ///
- /// Gets the application by its alias.
- ///
- /// The application alias.
- ///
- public static Application getByAlias(string appAlias)
- {
- return Mapper.Map(
- ApplicationContext.Current.Services.SectionService.GetByAlias(appAlias));
- }
-
- ///
- /// Deletes this instance.
- ///
- public void Delete()
- {
- ApplicationContext.Current.Services.SectionService.DeleteSection(Mapper.Map(this));
- }
-
- ///
- /// Gets all applications registered in umbraco from the umbracoApp table..
- ///
- /// Returns a Application Array
- public static List getAll()
- {
- return ApplicationContext.Current.Services.SectionService.GetSections().Select(Mapper.Map).ToList();
- }
-
-
-
-
- }
-}
diff --git a/src/umbraco.businesslogic/LegacySqlHelper.cs b/src/umbraco.businesslogic/LegacySqlHelper.cs
new file mode 100644
index 0000000000..f3f8305f6e
--- /dev/null
+++ b/src/umbraco.businesslogic/LegacySqlHelper.cs
@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Linq;
+using AutoMapper;
+using Umbraco.Core;
+using Umbraco.Core.Logging;
+using Umbraco.Core.Models;
+using umbraco.DataLayer;
+
+
+namespace umbraco.BusinessLogic
+{
+ ///
+ /// Class for handling all registered applications in Umbraco.
+ ///
+ [Obsolete("Use ApplicationContext.Current.Services.SectionService and/or Umbraco.Core.Sections.SectionCollection instead")]
+ public class LegacySqlHelper
+ {
+ private static ISqlHelper _sqlHelper;
+
+ ///
+ /// Gets the SQL helper.
+ ///
+ /// The SQL helper.
+ [Obsolete("Do not use SqlHelper anymore, if database querying needs to be done use the DatabaseContext instead")]
+ public static ISqlHelper SqlHelper
+ {
+ get
+ {
+ if (_sqlHelper == null)
+ {
+ var connectionString = string.Empty;
+
+ try
+ {
+ const string umbracoDsn = Umbraco.Core.Configuration.GlobalSettings.UmbracoConnectionName;
+
+ var databaseSettings = ConfigurationManager.ConnectionStrings[umbracoDsn];
+ if (databaseSettings != null)
+ connectionString = databaseSettings.ConnectionString;
+
+ // During upgrades we might still have the old appSettings connectionstring, and not the new one, so get that one instead
+ if (string.IsNullOrWhiteSpace(connectionString) &&
+ ConfigurationManager.AppSettings.ContainsKey(umbracoDsn))
+ connectionString = ConfigurationManager.AppSettings[umbracoDsn];
+
+ _sqlHelper = DataLayerHelper.CreateSqlHelper(connectionString, false);
+ }
+ catch(Exception ex)
+ {
+ LogHelper.Error(string.Format("Can't instantiate SQLHelper with connectionstring \"{0}\"", connectionString), ex);
+ }
+ }
+
+ return _sqlHelper;
+ }
+ }
+
+ }
+}
diff --git a/src/umbraco.businesslogic/umbraco.businesslogic.csproj b/src/umbraco.businesslogic/umbraco.businesslogic.csproj
index 3295e9592f..5ebef93611 100644
--- a/src/umbraco.businesslogic/umbraco.businesslogic.csproj
+++ b/src/umbraco.businesslogic/umbraco.businesslogic.csproj
@@ -182,7 +182,7 @@
Properties\SolutionInfo.cs
-
+
Code
diff --git a/src/umbraco.cms/businesslogic/CMSNode.cs b/src/umbraco.cms/businesslogic/CMSNode.cs
index 561af62c83..a720d5e715 100644
--- a/src/umbraco.cms/businesslogic/CMSNode.cs
+++ b/src/umbraco.cms/businesslogic/CMSNode.cs
@@ -344,7 +344,7 @@ namespace umbraco.cms.businesslogic
[Obsolete("Obsolete, For querying the database use the new UmbracoDatabase object ApplicationContext.Current.DatabaseContext.Database", false)]
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
internal static UmbracoDatabase Database
diff --git a/src/umbraco.cms/businesslogic/Dictionary.cs b/src/umbraco.cms/businesslogic/Dictionary.cs
index b282493f07..6bf76ccb12 100644
--- a/src/umbraco.cms/businesslogic/Dictionary.cs
+++ b/src/umbraco.cms/businesslogic/Dictionary.cs
@@ -26,7 +26,7 @@ namespace umbraco.cms.businesslogic
[Obsolete("Obsolete, For querying the database use the new UmbracoDatabase object ApplicationContext.Current.DatabaseContext.Database")]
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
///
diff --git a/src/umbraco.cms/businesslogic/Packager/Package.cs b/src/umbraco.cms/businesslogic/Packager/Package.cs
index 7bd3b891bc..136eb06a99 100644
--- a/src/umbraco.cms/businesslogic/Packager/Package.cs
+++ b/src/umbraco.cms/businesslogic/Packager/Package.cs
@@ -11,7 +11,7 @@ namespace umbraco.cms.businesslogic.packager
{
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
public Package()
diff --git a/src/umbraco.cms/businesslogic/Packager/PackageActions/addApplication.cs b/src/umbraco.cms/businesslogic/Packager/PackageActions/addApplication.cs
index 3f5b08e35b..4bd457f2d7 100644
--- a/src/umbraco.cms/businesslogic/Packager/PackageActions/addApplication.cs
+++ b/src/umbraco.cms/businesslogic/Packager/PackageActions/addApplication.cs
@@ -1,5 +1,6 @@
using System;
using System.Xml;
+using Umbraco.Core;
namespace umbraco.cms.businesslogic.packager.standardPackageActions
{
@@ -27,15 +28,19 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions
string alias = xmlData.Attributes["appAlias"].Value;
string icon = xmlData.Attributes["appIcon"].Value;
- BusinessLogic.Application.MakeNew(name, alias, icon);
-
+ ApplicationContext.Current.Services.SectionService.MakeNew(name, alias, icon);
+
return true;
}
public bool Undo(string packageName, XmlNode xmlData)
{
string alias = xmlData.Attributes["appAlias"].Value;
- BusinessLogic.Application.getByAlias(alias).Delete();
+ var section = ApplicationContext.Current.Services.SectionService.GetByAlias(alias);
+ if (section != null)
+ {
+ ApplicationContext.Current.Services.SectionService.DeleteSection(section);
+ }
return true;
}
///
diff --git a/src/umbraco.cms/businesslogic/language/Item.cs b/src/umbraco.cms/businesslogic/language/Item.cs
index 7c519b776f..bf4dfb8682 100644
--- a/src/umbraco.cms/businesslogic/language/Item.cs
+++ b/src/umbraco.cms/businesslogic/language/Item.cs
@@ -28,7 +28,7 @@ namespace umbraco.cms.businesslogic.language
[Obsolete("Obsolete, For querying the database use the new UmbracoDatabase object ApplicationContext.Current.DatabaseContext.Database", false)]
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
///
diff --git a/src/umbraco.cms/businesslogic/language/Language.cs b/src/umbraco.cms/businesslogic/language/Language.cs
index c5badc001b..8a92bdfa84 100644
--- a/src/umbraco.cms/businesslogic/language/Language.cs
+++ b/src/umbraco.cms/businesslogic/language/Language.cs
@@ -42,7 +42,7 @@ namespace umbraco.cms.businesslogic.language
[Obsolete("Obsolete, For querying the database use the new UmbracoDatabase object ApplicationContext.Current.DatabaseContext.Database", false)]
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
diff --git a/src/umbraco.cms/businesslogic/macro/Macro.cs b/src/umbraco.cms/businesslogic/macro/Macro.cs
index 4010750d62..da9aa6c83e 100644
--- a/src/umbraco.cms/businesslogic/macro/Macro.cs
+++ b/src/umbraco.cms/businesslogic/macro/Macro.cs
@@ -37,7 +37,7 @@ namespace umbraco.cms.businesslogic.macro
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
///
diff --git a/src/umbraco.cms/businesslogic/macro/MacroProperty.cs b/src/umbraco.cms/businesslogic/macro/MacroProperty.cs
index 3535104063..c5e19b1702 100644
--- a/src/umbraco.cms/businesslogic/macro/MacroProperty.cs
+++ b/src/umbraco.cms/businesslogic/macro/MacroProperty.cs
@@ -24,7 +24,7 @@ namespace umbraco.cms.businesslogic.macro
{
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
///
diff --git a/src/umbraco.cms/businesslogic/macro/macroPropertyType.cs b/src/umbraco.cms/businesslogic/macro/macroPropertyType.cs
index 85f4ac165e..f4b6dc960e 100644
--- a/src/umbraco.cms/businesslogic/macro/macroPropertyType.cs
+++ b/src/umbraco.cms/businesslogic/macro/macroPropertyType.cs
@@ -15,7 +15,7 @@ namespace umbraco.cms.businesslogic.macro
{
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
public static List GetAll
diff --git a/src/umbraco.cms/businesslogic/propertytype/PropertyTypeGroup.cs b/src/umbraco.cms/businesslogic/propertytype/PropertyTypeGroup.cs
index a92e18800a..cac259f1a1 100644
--- a/src/umbraco.cms/businesslogic/propertytype/PropertyTypeGroup.cs
+++ b/src/umbraco.cms/businesslogic/propertytype/PropertyTypeGroup.cs
@@ -149,7 +149,7 @@ namespace umbraco.cms.businesslogic.propertytype
/// The SQL helper.
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
}
}
\ No newline at end of file
diff --git a/src/umbraco.cms/businesslogic/propertytype/propertytype.cs b/src/umbraco.cms/businesslogic/propertytype/propertytype.cs
index d0cef8f10e..b9d8d20a44 100644
--- a/src/umbraco.cms/businesslogic/propertytype/propertytype.cs
+++ b/src/umbraco.cms/businesslogic/propertytype/propertytype.cs
@@ -39,7 +39,7 @@ namespace umbraco.cms.businesslogic.propertytype
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
#region Constructors
diff --git a/src/umbraco.cms/businesslogic/relation/Relation.cs b/src/umbraco.cms/businesslogic/relation/Relation.cs
index dd66cf5c4c..533ebfa870 100644
--- a/src/umbraco.cms/businesslogic/relation/Relation.cs
+++ b/src/umbraco.cms/businesslogic/relation/Relation.cs
@@ -38,7 +38,7 @@ namespace umbraco.cms.businesslogic.relation
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
public CMSNode Parent
diff --git a/src/umbraco.cms/businesslogic/task/Task.cs b/src/umbraco.cms/businesslogic/task/Task.cs
index 131cb5a6da..5eb0a353af 100644
--- a/src/umbraco.cms/businesslogic/task/Task.cs
+++ b/src/umbraco.cms/businesslogic/task/Task.cs
@@ -136,7 +136,7 @@ namespace umbraco.cms.businesslogic.task
/// The SQL helper.
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
#endregion
diff --git a/src/umbraco.cms/businesslogic/task/TaskType.cs b/src/umbraco.cms/businesslogic/task/TaskType.cs
index ce21a2f85c..5bc87e9452 100644
--- a/src/umbraco.cms/businesslogic/task/TaskType.cs
+++ b/src/umbraco.cms/businesslogic/task/TaskType.cs
@@ -53,7 +53,7 @@ namespace umbraco.cms.businesslogic.task
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
private Tasks _tasks;
diff --git a/src/umbraco.cms/businesslogic/workflow/Notification.cs b/src/umbraco.cms/businesslogic/workflow/Notification.cs
index f7f7e48fd5..4f7487c08a 100644
--- a/src/umbraco.cms/businesslogic/workflow/Notification.cs
+++ b/src/umbraco.cms/businesslogic/workflow/Notification.cs
@@ -46,7 +46,7 @@ namespace umbraco.cms.businesslogic.workflow
[Obsolete("Obsolete, For querying the database use the new UmbracoDatabase object ApplicationContext.Current.DatabaseContext.Database", false)]
protected static ISqlHelper SqlHelper
{
- get { return Application.SqlHelper; }
+ get { return LegacySqlHelper.SqlHelper; }
}
///