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


C# Blog.MarkOld方法代码示例

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


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

示例1: FillBlogs

        /// <summary>
        /// Fills an unsorted list of Blogs.
        /// </summary>
        /// <returns>
        /// A List&lt;Blog&gt; of all Blogs
        /// </returns>
        public override List<Blog> FillBlogs()
        {
            var blogs = new List<Blog>();

            // we want the folder of the primary blog instance, as "Blogs" is site-wide, not per-blog.
            // pass null to GetFolder() to get the base storage location.
            var fileName = this.GetFolder(null) + "blogs.xml";
            if (!File.Exists(fileName))
            {
                return blogs;
            }

            var doc = new XmlDocument();
            doc.Load(fileName);

            var nodes = doc.SelectNodes("blogs/item");
            if (nodes != null)
            {

                foreach (XmlNode node in nodes)
                {
                    var b = new Blog()
                    {
                        Id = node.Attributes["id"] == null ? Guid.NewGuid() : new Guid(node.Attributes["id"].Value),
                        Name = node.Attributes["name"] == null ? string.Empty : node.Attributes["name"].Value,
                        StorageContainerName = node.Attributes["storageContainerName"] == null ? string.Empty : node.Attributes["storageContainerName"].Value,
                        Hostname = node.Attributes["hostName"] == null ? string.Empty : node.Attributes["hostName"].Value,
                        IsAnyTextBeforeHostnameAccepted = node.Attributes["isAnyTextBeforeHostnameAccepted"] == null ? false : bool.Parse(node.Attributes["isAnyTextBeforeHostnameAccepted"].Value),
                        VirtualPath = node.Attributes["virtualPath"] == null ? string.Empty : node.Attributes["virtualPath"].Value,
                        IsPrimary = node.Attributes["isPrimary"] == null ? false : bool.Parse(node.Attributes["isPrimary"].Value),
                        IsActive = node.Attributes["isActive"] == null ? false : bool.Parse(node.Attributes["isActive"].Value),
                        IsSiteAggregation = node.Attributes["isSiteAggregation"] == null ? false : bool.Parse(node.Attributes["isSiteAggregation"].Value)
                    };

                    blogs.Add(b);
                    b.MarkOld();   
                }
            }

            return blogs;
        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:47,代码来源:Blogs.cs

示例2: FillBlogs

        /// <summary>
        /// Gets all Blogs in database
        /// </summary>
        /// <returns>
        /// List of Blogs
        /// </returns>
        public override List<Blog> FillBlogs()
        {
            var blogs = new List<Blog>();

            using (var conn = this.CreateConnection())
            {
                if (conn.HasConnection)
                {
                    using (var cmd = conn.CreateTextCommand(string.Format("SELECT BlogId, BlogName, Hostname, IsAnyTextBeforeHostnameAccepted, StorageContainerName, VirtualPath, IsPrimary, IsActive, IsSiteAggregation FROM {0}Blogs ", this.tablePrefix)))
                    {
                        using (var rdr = cmd.ExecuteReader())
                        {
                            while (rdr.Read())
                            {
                                var b = new Blog
                                {
                                    Id = rdr.GetGuid(0),
                                    Name = rdr.GetString(1),
                                    Hostname = rdr.GetString(2),
                                    IsAnyTextBeforeHostnameAccepted = rdr.GetBoolean(3),
                                    StorageContainerName = rdr.GetString(4),
                                    VirtualPath = rdr.GetString(5),
                                    IsPrimary = rdr.GetBoolean(6),
                                    IsActive = rdr.GetBoolean(7),
                                    IsSiteAggregation = rdr.GetBoolean(8)
                                };

                                blogs.Add(b);
                                b.MarkOld();
                            }
                        }
                    }
                }
            }

            return blogs;
        }
开发者ID:royosherove,项目名称:tddnetcoursedemos,代码行数:43,代码来源:DbBlogProvider.cs


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