/*
Kooboo is a content management system based on ASP.NET MVC framework. Copyright 2009 Yardi Technology Limited.
This program is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License version 3 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, see http://www.kooboo.com/gpl3/.
*/
using System;
using System.Data;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.Data.Common;
using System.Data.SqlClient;
using Microsoft.Data.Extensions;
using Everest.Library;
using Everest.Library.Data;
using Everest.Library.Data.Entity;
using Everest.Library.ExtensionMethod;
using Everest.CmsServices.Models;
using Everest.CmsServices.Services;
using Everest.CmsServices.DataRule;
namespace Everest.CmsServices.Providers.SqlServer{
public class SqlServerContentProvider : IContentProvider
{
//public const string LogSourceName = "Data Access Events";
public SqlServerContentProvider()
{
TextContentQuerier = new SqlServerTextContentQuerier();
TextContentManager = new SqlServerTextContentManager();
BinaryContentManager = new SqlServerBinaryContentManager();
BinaryContentQuerier = new SqlServerBinaryContentQuerier();
SystemManager = new SqlSystemManager();
}
#region IContentProvider Members
public ITextContentQuerier TextContentQuerier
{
get;
private set;
}
public ITextContentManager TextContentManager
{
get;
private set;
}
public IBinaryContentManager BinaryContentManager { get; private set; }
public IBinaryContentQuerier BinaryContentQuerier { get; private set; }
public ISystemManager SystemManager
{
get;
private set;
}
#endregion
public static void Log(string methodName, DbCommand command)
{
if (CmsGlobal.EnableLog)
{
StringBuilder parameterBuilder = new StringBuilder();
foreach (DbParameter p in command.Parameters)
{
parameterBuilder.AppendFormat("{0}:{1},", p.ParameterName, p.Value);
}
System.Diagnostics.Trace.WriteLine(string.Format("{0}:{1}\t Parameters:{2}", methodName, command.CommandText, parameterBuilder.ToString()));
}
}
}
}
|