当前位置: 首页>>代码示例>>C#>>正文


C# Repository.GetConnectionString方法代码示例

本文整理汇总了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());
 }
开发者ID:jason1234,项目名称:CMS,代码行数:5,代码来源:TextContentProvider.cs

示例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;
 }
开发者ID:jason1234,项目名称:CMS,代码行数:27,代码来源:TextContentProvider.cs

示例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;
        }
开发者ID:jason1234,项目名称:CMS,代码行数:31,代码来源:TextContentProvider.cs

示例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);
        }
开发者ID:jason1234,项目名称:CMS,代码行数:12,代码来源:TextContentProvider.cs

示例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());
     }
 }
开发者ID:Epitomy,项目名称:CMS,代码行数:25,代码来源:SchemaManager.cs


注:本文中的Kooboo.CMS.Content.Models.Repository.GetConnectionString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。