本文整理汇总了C#中Kooboo.CMS.Content.Models.Repository.GetConnectionString方法的典型用法代码示例。如果您正苦于以下问题:C# Repository.GetConnectionString方法的具体用法?C# Repository.GetConnectionString怎么用?C# Repository.GetConnectionString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kooboo.CMS.Content.Models.Repository
的用法示例。
在下文中一共展示了Repository.GetConnectionString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ImportCategoryData
public void ImportCategoryData(Repository repository, IEnumerable<Category> data)
{
SQLCeHelper.ExecuteNonQuery(repository.GetConnectionString(),
data.Select(it => dbCommands.AddCategory(repository, it)).ToArray());
}
示例2: ExportCategoryData
public IEnumerable<Category> ExportCategoryData(Repository repository)
{
var connectionString = repository.GetConnectionString();
string sql = string.Format("SELECT UUID,CategoryFolder,CategoryUUID FROM [{0}] ", repository.GetCategoryTableName());
List<Category> list = new List<Category>();
SqlCeConnection connection;
using (var reader = SQLCeHelper.ExecuteReader(connectionString, new SqlCeCommand() { CommandText = sql }, out connection))
{
try
{
while (reader.Read())
{
Category category = new Category();
category.ContentUUID = reader.GetString(0);
category.CategoryFolder = reader.GetString(1);
category.CategoryUUID = reader.GetString(2);
list.Add(category);
}
}
finally
{
reader.Close();
connection.Close();
}
}
return list;
}
示例3: ExecuteQuery
public IEnumerable<IDictionary<string, object>> ExecuteQuery(Repository repository, string queryText, System.Data.CommandType commandType = System.Data.CommandType.Text, params KeyValuePair<string, object>[] parameters)
{
var connectionString = repository.GetConnectionString();
var command = new System.Data.SqlServerCe.SqlCeCommand(queryText);
if (parameters != null && parameters.Length > 0)
{
command.Parameters.AddRange(parameters.Select(it => new System.Data.SqlServerCe.SqlCeParameter() { ParameterName = it.Key, Value = it.Value }).ToArray());
}
command.CommandType = commandType;
List<IDictionary<string, object>> list = new List<IDictionary<string, object>>();
SqlCeConnection connection;
using (var dataReader = SQLCeHelper.ExecuteReader(connectionString, command, out connection))
{
try
{
while (dataReader.Read())
{
TextContent content = new TextContent();
dataReader.ToContent(content);
list.Add(content);
}
}
finally
{
dataReader.Close();
connection.Close();
}
}
return list;
}
示例4: ExecuteScalar
public object ExecuteScalar(Repository repository, string queryText, System.Data.CommandType commandType = System.Data.CommandType.Text, params KeyValuePair<string, object>[] parameters)
{
var connectionString = repository.GetConnectionString();
var command = new System.Data.SqlServerCe.SqlCeCommand(queryText);
if (parameters != null && parameters.Length > 0)
{
command.Parameters.AddRange(parameters.Select(it => new System.Data.SqlServerCe.SqlCeParameter() { ParameterName = it.Key, Value = it.Value }).ToArray());
}
command.CommandType = commandType;
return SQLCeHelper.ExecuteScalar(connectionString, command);
}
示例5: ExecuteDDL
// private static void CreateMediaContentTable(Repository repository)
// {
// string ddl = string.Format(@"CREATE TABLE [{0}] (
// Id int IDENTITY (100,1),
// UUID nvarchar(36) NOT NULL PRIMARY KEY,
// UserKey nvarchar(526),
// UtcCreationDate datetime,
// UtcLastModificationDate datetime,
// Published bit,
// OriginalUUID nvarchar(36),
// FolderName nvarchar(256),
// FileName nvarchar(256),
// VirtualPath nvarchar(256),
// UserId nvarchar(256)
// );", repository.GetMediaContentTableName());
// ExecuteDDL(repository, ddl);
// }
protected static void ExecuteDDL(Repository repository, string ddl)
{
if (!string.IsNullOrEmpty(ddl))
{
SQLCeHelper.ExecuteNonQuery(repository.GetConnectionString(),
ddl.Split(';').Where(it => !string.IsNullOrEmpty(it)).Select(it => new SqlCeCommand(it, null)).ToArray());
}
}