removes ISqlHelper usages from Web project
This commit is contained in:
@@ -83,13 +83,6 @@ namespace Umbraco.Web.UI.Controls
|
||||
{
|
||||
get { return _url ?? (_url = new UrlHelper(new RequestContext(new HttpContextWrapper(Context), new RouteData()))); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the legacy SqlHelper
|
||||
/// </summary>
|
||||
protected ISqlHelper SqlHelper
|
||||
{
|
||||
get { return Application.SqlHelper; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -136,12 +136,5 @@ namespace Umbraco.Web.UI.Controls
|
||||
get { return _url ?? (_url = new UrlHelper(new RequestContext(new HttpContextWrapper(Context), new RouteData()))); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the legacy SqlHelper
|
||||
/// </summary>
|
||||
protected ISqlHelper SqlHelper
|
||||
{
|
||||
get { return global::umbraco.BusinessLogic.Application.SqlHelper; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -147,12 +147,7 @@ namespace umbraco
|
||||
{
|
||||
get { return _xmlContent == null; }
|
||||
}
|
||||
|
||||
protected static ISqlHelper SqlHelper
|
||||
{
|
||||
get { return Application.SqlHelper; }
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
@@ -493,57 +488,48 @@ where umbracoNode.id in (select cmsDocument.nodeId from cmsDocument where cmsDoc
|
||||
order by umbracoNode.level, umbracoNode.sortOrder";
|
||||
|
||||
|
||||
|
||||
using (
|
||||
IRecordsReader dr = SqlHelper.ExecuteReader(sql,
|
||||
SqlHelper.CreateParameter("@type",
|
||||
new Guid(
|
||||
Constants.ObjectTypes.Document)))
|
||||
)
|
||||
foreach (var dr in ApplicationContext.Current.DatabaseContext.Database.Query<dynamic>(sql, new { type = new Guid(Constants.ObjectTypes.Document)}))
|
||||
{
|
||||
while (dr.Read())
|
||||
int currentId = dr.id;
|
||||
int parentId = dr.parentId;
|
||||
string xml = dr.xml;
|
||||
|
||||
// fix sortOrder - see notes in UpdateSortOrder
|
||||
var tmp = new XmlDocument();
|
||||
tmp.LoadXml(xml);
|
||||
var attr = tmp.DocumentElement.GetAttributeNode("sortOrder");
|
||||
attr.Value = dr.sortOrder.ToString();
|
||||
xml = tmp.InnerXml;
|
||||
|
||||
// Call the eventhandler to allow modification of the string
|
||||
var e1 = new ContentCacheLoadNodeEventArgs();
|
||||
FireAfterContentCacheDatabaseLoadXmlString(ref xml, e1);
|
||||
// check if a listener has canceled the event
|
||||
if (!e1.Cancel)
|
||||
{
|
||||
int currentId = dr.GetInt("id");
|
||||
int parentId = dr.GetInt("parentId");
|
||||
string xml = dr.GetString("xml");
|
||||
|
||||
// fix sortOrder - see notes in UpdateSortOrder
|
||||
var tmp = new XmlDocument();
|
||||
tmp.LoadXml(xml);
|
||||
var attr = tmp.DocumentElement.GetAttributeNode("sortOrder");
|
||||
attr.Value = dr.GetInt("sortOrder").ToString();
|
||||
xml = tmp.InnerXml;
|
||||
|
||||
// Call the eventhandler to allow modification of the string
|
||||
var e1 = new ContentCacheLoadNodeEventArgs();
|
||||
FireAfterContentCacheDatabaseLoadXmlString(ref xml, e1);
|
||||
// check if a listener has canceled the event
|
||||
// and parse it into a DOM node
|
||||
xmlDoc.LoadXml(xml);
|
||||
XmlNode node = xmlDoc.FirstChild;
|
||||
// same event handler loader form the xml node
|
||||
var e2 = new ContentCacheLoadNodeEventArgs();
|
||||
FireAfterContentCacheLoadNodeFromDatabase(node, e2);
|
||||
// and checking if it was canceled again
|
||||
if (!e1.Cancel)
|
||||
{
|
||||
// and parse it into a DOM node
|
||||
xmlDoc.LoadXml(xml);
|
||||
XmlNode node = xmlDoc.FirstChild;
|
||||
// same event handler loader form the xml node
|
||||
var e2 = new ContentCacheLoadNodeEventArgs();
|
||||
FireAfterContentCacheLoadNodeFromDatabase(node, e2);
|
||||
// and checking if it was canceled again
|
||||
if (!e1.Cancel)
|
||||
{
|
||||
nodeIndex.Add(currentId, node);
|
||||
nodeIndex.Add(currentId, node);
|
||||
|
||||
// verify if either of the handlers canceled the children to load
|
||||
if (!e1.CancelChildren && !e2.CancelChildren)
|
||||
// verify if either of the handlers canceled the children to load
|
||||
if (!e1.CancelChildren && !e2.CancelChildren)
|
||||
{
|
||||
// Build the content hierarchy
|
||||
List<int> children;
|
||||
if (!hierarchy.TryGetValue(parentId, out children))
|
||||
{
|
||||
// Build the content hierarchy
|
||||
List<int> children;
|
||||
if (!hierarchy.TryGetValue(parentId, out children))
|
||||
{
|
||||
// No children for this parent, so add one
|
||||
children = new List<int>();
|
||||
hierarchy.Add(parentId, children);
|
||||
}
|
||||
children.Add(currentId);
|
||||
// No children for this parent, so add one
|
||||
children = new List<int>();
|
||||
hierarchy.Add(parentId, children);
|
||||
}
|
||||
children.Add(currentId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,16 +71,7 @@ namespace umbraco
|
||||
private page _page;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
protected static ISqlHelper SqlHelper
|
||||
{
|
||||
get { return umbraco.BusinessLogic.Application.SqlHelper; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
@@ -1213,16 +1204,15 @@ namespace umbraco
|
||||
XmlDocument xd = new XmlDocument();
|
||||
xd.LoadXml("<preValues/>");
|
||||
|
||||
using (IRecordsReader dr = SqlHelper.ExecuteReader("Select id, [value] from cmsDataTypeprevalues where DataTypeNodeId = @dataTypeId order by sortorder",
|
||||
SqlHelper.CreateParameter("@dataTypeId", DataTypeId)))
|
||||
foreach (var dr in ApplicationContext.Current.DatabaseContext.Database.Query<dynamic>(
|
||||
"Select id, [value] from cmsDataTypeprevalues where DataTypeNodeId = @dataTypeId order by sortorder",
|
||||
new { dataTypeId = DataTypeId }))
|
||||
{
|
||||
while (dr.Read())
|
||||
{
|
||||
XmlNode n = XmlHelper.AddTextNode(xd, "preValue", dr.GetString("value"));
|
||||
n.Attributes.Append(XmlHelper.AddAttribute(xd, "id", dr.GetInt("id").ToString()));
|
||||
xd.DocumentElement.AppendChild(n);
|
||||
}
|
||||
XmlNode n = XmlHelper.AddTextNode(xd, "preValue", dr.value);
|
||||
n.Attributes.Append(XmlHelper.AddAttribute(xd, "id", dr.id.ToString()));
|
||||
xd.DocumentElement.AppendChild(n);
|
||||
}
|
||||
|
||||
XPathNavigator xp = xd.CreateNavigator();
|
||||
return xp.Select("/preValues");
|
||||
}
|
||||
@@ -1236,8 +1226,9 @@ namespace umbraco
|
||||
{
|
||||
try
|
||||
{
|
||||
return SqlHelper.ExecuteScalar<string>("select [value] from cmsDataTypePreValues where id = @id",
|
||||
SqlHelper.CreateParameter("@id", Id));
|
||||
return ApplicationContext.Current.DatabaseContext.Database.ExecuteScalar<string>(
|
||||
"select [value] from cmsDataTypePreValues where id = @id",
|
||||
new {id = Id});
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -60,12 +60,7 @@ namespace umbraco
|
||||
private readonly StringBuilder _content = new StringBuilder();
|
||||
private const string MacrosAddedKey = "macrosAdded";
|
||||
public IList<Exception> Exceptions = new List<Exception>();
|
||||
|
||||
protected static ISqlHelper SqlHelper
|
||||
{
|
||||
get { return Application.SqlHelper; }
|
||||
}
|
||||
|
||||
|
||||
static macro()
|
||||
{
|
||||
_xsltSettings = SystemUtilities.GetCurrentTrustLevel() > AspNetHostingPermissionLevel.Medium
|
||||
|
||||
@@ -457,11 +457,7 @@ namespace umbraco
|
||||
|
||||
#endregion
|
||||
|
||||
protected static ISqlHelper SqlHelper
|
||||
{
|
||||
get { return Application.SqlHelper; }
|
||||
}
|
||||
|
||||
|
||||
#region constructors
|
||||
|
||||
public static string GetMasterPageName(int templateID)
|
||||
@@ -485,25 +481,25 @@ namespace umbraco
|
||||
var t = ApplicationContext.Current.ApplicationCache.RuntimeCache.GetCacheItem<template>(
|
||||
string.Format("{0}{1}", CacheKeys.TemplateFrontEndCacheKey, tId), () =>
|
||||
{
|
||||
using (var templateData = SqlHelper.ExecuteReader(@"select nodeId, alias, node.parentID as master, text, design
|
||||
var templateData = ApplicationContext.Current.DatabaseContext.Database.FirstOrDefault<dynamic>(
|
||||
@"select nodeId, alias, node.parentID as master, text, design
|
||||
from cmsTemplate
|
||||
inner join umbracoNode node on (node.id = cmsTemplate.nodeId)
|
||||
where nodeId = @templateID",
|
||||
SqlHelper.CreateParameter("@templateID", templateID)))
|
||||
{
|
||||
if (templateData.Read())
|
||||
{
|
||||
// Get template master and replace content where the template
|
||||
if (!templateData.IsNull("master"))
|
||||
_masterTemplate = templateData.GetInt("master");
|
||||
if (!templateData.IsNull("alias"))
|
||||
_templateAlias = templateData.GetString("alias");
|
||||
if (!templateData.IsNull("text"))
|
||||
_templateName = templateData.GetString("text");
|
||||
if (!templateData.IsNull("design"))
|
||||
_templateDesign = templateData.GetString("design");
|
||||
}
|
||||
new {templateID = templateID});
|
||||
if (templateData != null)
|
||||
{
|
||||
// Get template master and replace content where the template
|
||||
if (templateData.master != null)
|
||||
_masterTemplate = templateData.master;
|
||||
if (templateData.alias != null)
|
||||
_templateAlias = templateData.alias;
|
||||
if (templateData.text != null)
|
||||
_templateName = templateData.text;
|
||||
if (templateData.design != null)
|
||||
_templateDesign = templateData.design;
|
||||
}
|
||||
|
||||
return this;
|
||||
});
|
||||
|
||||
|
||||
@@ -24,11 +24,6 @@ namespace umbraco
|
||||
rootNode.NodeID = "init";
|
||||
}
|
||||
|
||||
protected static ISqlHelper SqlHelper
|
||||
{
|
||||
get { return umbraco.BusinessLogic.Application.SqlHelper; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Renders the JS.
|
||||
/// </summary>
|
||||
@@ -50,24 +45,20 @@ function openMacro(id) {
|
||||
/// <param name="tree"></param>
|
||||
public override void Render(ref XmlTree tree)
|
||||
{
|
||||
using (IRecordsReader macros = SqlHelper.ExecuteReader("select id, macroName from cmsMacro order by macroName"))
|
||||
foreach(var macros in ApplicationContext.Current.DatabaseContext.Database.Query<dynamic>("select id, macroName from cmsMacro order by macroName"))
|
||||
{
|
||||
|
||||
while (macros.Read())
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
xNode.NodeID = macros.id.ToString();
|
||||
xNode.Text = macros.macroName;
|
||||
xNode.Action = "javascript:openMacro(" + macros.id + ");";
|
||||
xNode.Icon = " icon-settings-alt";
|
||||
xNode.OpenIcon = "icon-settings-alt";
|
||||
OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
if (xNode != null)
|
||||
{
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
xNode.NodeID = macros.GetInt("id").ToString();
|
||||
xNode.Text = macros.GetString("macroName");
|
||||
xNode.Action = "javascript:openMacro(" + macros.GetInt("id") + ");";
|
||||
xNode.Icon = " icon-settings-alt";
|
||||
xNode.OpenIcon = "icon-settings-alt";
|
||||
OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
if (xNode != null)
|
||||
{
|
||||
tree.Add(xNode);
|
||||
}
|
||||
OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
tree.Add(xNode);
|
||||
}
|
||||
OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,6 @@ namespace umbraco
|
||||
public class macroTasks : LegacyDialogTask
|
||||
{
|
||||
|
||||
protected static ISqlHelper SqlHelper
|
||||
{
|
||||
get { return Application.SqlHelper; }
|
||||
}
|
||||
|
||||
public override bool PerformSave()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user