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


C# Blog.DeleteBlogFolder方法代码示例

本文整理汇总了C#中Blog.DeleteBlogFolder方法的典型用法代码示例。如果您正苦于以下问题:C# Blog.DeleteBlogFolder方法的具体用法?C# Blog.DeleteBlogFolder怎么用?C# Blog.DeleteBlogFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Blog的用法示例。


在下文中一共展示了Blog.DeleteBlogFolder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeleteBlogStorageContainer

 /// <summary>
 /// Deletes the blog's storage container.
 /// </summary>
 /// <param name="blog">
 /// The blog.
 /// </param>
 public override bool DeleteBlogStorageContainer(Blog blog)
 {
     return blog.DeleteBlogFolder();
 }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:10,代码来源:Blogs.cs

示例2: DeleteBlogStorageContainer

        /// <summary>
        /// Deletes the blog's storage container.
        /// </summary>
        /// <param name="blog">
        /// The blog.
        /// </param>
        public override bool DeleteBlogStorageContainer(Blog blog)
        {
            // First delete the blog folder.  Even the DB provider uses
            // the folder.  This is rare and is usually by widgets/extensions.
            if (!blog.DeleteBlogFolder())
            {
                return false;
            }

            // Delete data from all tables except for be_Blogs.  The blog
            // data from be_Blogs will be deleted in DeleteBlog().

            using (var conn = this.CreateConnection())
            {
                if (conn.HasConnection)
                {
                    // Note, the order here is important, especially for the DBs where
                    // foreign key constraints are setup (SQL Server is one).  The data
                    // in the referencing tables needs to be deleted first.

                    var sqlQuery = string.Format("DELETE FROM {0}PostTag WHERE BlogId = {1}BlogId", this.tablePrefix, this.parmPrefix);
                    using (var cmd = conn.CreateTextCommand(sqlQuery))
                    {
                        cmd.Parameters.Add(conn.CreateParameter(FormatParamName("BlogId"), blog.Id.ToString()));
                        cmd.ExecuteNonQuery();
                    }

                    sqlQuery = string.Format("DELETE FROM {0}PostNotify WHERE BlogId = {1}BlogId", this.tablePrefix, this.parmPrefix);
                    using (var cmd = conn.CreateTextCommand(sqlQuery))
                    {
                        cmd.Parameters.Add(conn.CreateParameter(FormatParamName("BlogId"), blog.Id.ToString()));
                        cmd.ExecuteNonQuery();
                    }

                    sqlQuery = string.Format("DELETE FROM {0}PostComment WHERE BlogId = {1}BlogId", this.tablePrefix, this.parmPrefix);
                    using (var cmd = conn.CreateTextCommand(sqlQuery))
                    {
                        cmd.Parameters.Add(conn.CreateParameter(FormatParamName("BlogId"), blog.Id.ToString()));
                        cmd.ExecuteNonQuery();
                    }

                    sqlQuery = string.Format("DELETE FROM {0}PostCategory WHERE BlogId = {1}BlogId", this.tablePrefix, this.parmPrefix);
                    using (var cmd = conn.CreateTextCommand(sqlQuery))
                    {
                        cmd.Parameters.Add(conn.CreateParameter(FormatParamName("BlogId"), blog.Id.ToString()));
                        cmd.ExecuteNonQuery();
                    }

                    sqlQuery = string.Format("DELETE FROM {0}Posts WHERE BlogId = {1}BlogId", this.tablePrefix, this.parmPrefix);
                    using (var cmd = conn.CreateTextCommand(sqlQuery))
                    {
                        cmd.Parameters.Add(conn.CreateParameter(FormatParamName("BlogId"), blog.Id.ToString()));
                        cmd.ExecuteNonQuery();
                    }

                    sqlQuery = string.Format("DELETE FROM {0}RightRoles WHERE BlogId = {1}BlogId", this.tablePrefix, this.parmPrefix);
                    using (var cmd = conn.CreateTextCommand(sqlQuery))
                    {
                        cmd.Parameters.Add(conn.CreateParameter(FormatParamName("BlogId"), blog.Id.ToString()));
                        cmd.ExecuteNonQuery();
                    }

                    sqlQuery = string.Format("DELETE FROM {0}Profiles WHERE BlogId = {1}BlogId", this.tablePrefix, this.parmPrefix);
                    using (var cmd = conn.CreateTextCommand(sqlQuery))
                    {
                        cmd.Parameters.Add(conn.CreateParameter(FormatParamName("BlogId"), blog.Id.ToString()));
                        cmd.ExecuteNonQuery();
                    }

                    sqlQuery = string.Format("DELETE FROM {0}UserRoles WHERE BlogId = {1}BlogId", this.tablePrefix, this.parmPrefix);
                    using (var cmd = conn.CreateTextCommand(sqlQuery))
                    {
                        cmd.Parameters.Add(conn.CreateParameter(FormatParamName("BlogId"), blog.Id.ToString()));
                        cmd.ExecuteNonQuery();
                    }

                    sqlQuery = string.Format("DELETE FROM {0}Roles WHERE BlogId = {1}BlogId", this.tablePrefix, this.parmPrefix);
                    using (var cmd = conn.CreateTextCommand(sqlQuery))
                    {
                        cmd.Parameters.Add(conn.CreateParameter(FormatParamName("BlogId"), blog.Id.ToString()));
                        cmd.ExecuteNonQuery();
                    }

                    sqlQuery = string.Format("DELETE FROM {0}Rights WHERE BlogId = {1}BlogId", this.tablePrefix, this.parmPrefix);
                    using (var cmd = conn.CreateTextCommand(sqlQuery))
                    {
                        cmd.Parameters.Add(conn.CreateParameter(FormatParamName("BlogId"), blog.Id.ToString()));
                        cmd.ExecuteNonQuery();
                    }

                    sqlQuery = string.Format("DELETE FROM {0}Users WHERE BlogId = {1}BlogId", this.tablePrefix, this.parmPrefix);
                    using (var cmd = conn.CreateTextCommand(sqlQuery))
                    {
                        cmd.Parameters.Add(conn.CreateParameter(FormatParamName("BlogId"), blog.Id.ToString()));
//.........这里部分代码省略.........
开发者ID:royosherove,项目名称:tddnetcoursedemos,代码行数:101,代码来源:DbBlogProvider.cs


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