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


C# Blog.Create方法代码示例

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


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

示例1: FillData

		public void FillData()
		{
			ActiveRecordStarter.Initialize(GetConfigSource(), typeof(Blog), typeof(Post));
			Recreate();

			for (int i = 1; i <= 10; i++)
			{
				var blog = new Blog(i) { Name = "n" + i };
				blog.Create();
			}
		}
开发者ID:sheefa,项目名称:Castle.ActiveRecord,代码行数:11,代码来源:ActiveRecordDetachedQueryGenericTestCase.cs

示例2: SimpleOperations3

        public void SimpleOperations3()
        {
            using (new SessionScope()) {

                var blogs = Blog.FindAll().ToArray();

                Assert.IsNotNull(blogs);
                Assert.AreEqual(10, blogs.Length);

                var blog = new Blog {Name = "hammett's blog", Author = "hamilton verissimo"};
                blog.Create();

                blogs = Blog.FindAll().ToArray();
                Assert.AreEqual(blog.Name, blogs[10].Name);
                Assert.AreEqual(blog.Author, blogs[10].Author);

                Assert.IsNotNull(blogs);
                Assert.AreEqual(11, blogs.Length);

                blog.Name = "something else1";
                blog.Author = "something else2";
                blog.Update();

                blogs = Blog.FindAll().ToArray();

                Assert.IsNotNull(blogs);
                Assert.AreEqual(11, blogs.Length);
                blog = blogs.Last();
                Assert.AreEqual(blog.Name, blog.Name);
                Assert.AreEqual(blog.Author, blog.Author);
            }
        }
开发者ID:shosca,项目名称:ActiveRecord,代码行数:32,代码来源:ActiveRecordTestCase.cs

示例3: SetUp

        public override void SetUp()
        {
            base.SetUp();

            using (new SessionScope()) {
                for (var i = 1; i <= 10; i++) {
                    var blog = new Blog(i) {Name = "n" + i};
                    blog.Create();
                }
            }
        }
开发者ID:shosca,项目名称:ActiveRecord,代码行数:11,代码来源:ActiveRecordTestCase.cs

示例4: LinqSimpleOperations2

        public void LinqSimpleOperations2()
        {
            using (new SessionScope()) {
                var blogs = Blog.All;
                Assert.IsNotNull(blogs);
                Assert.AreEqual(10, blogs.Count());

                var blog = new Blog {Name = "hammett's blog", Author = "hamilton verissimo"};
                blog.Create();

                Assert.AreEqual(11, (from b in Blog.All select b).Count());

                blogs = Blog.All.OrderByDescending(b => b.Id);
                Assert.AreEqual(blog.Name, blogs.First().Name);
                Assert.AreEqual(blog.Author, blogs.First().Author);

                blog.Name = "something else1";
                blog.Author = "something else2";
                blog.Update();

                blogs = Blog.All.OrderByDescending(b => b.Id);
                Assert.IsNotNull(blogs);
                Assert.AreEqual(11, Blog.All.Count());
                Assert.AreEqual(blog.Name, blogs.First().Name);
                Assert.AreEqual(blog.Author, blogs.First().Author);
            }
        }
开发者ID:shosca,项目名称:ActiveRecord,代码行数:27,代码来源:ActiveRecordTestCase.cs

示例5: SimpleOperations2

        public void SimpleOperations2()
        {
            ActiveRecordStarter.Initialize(GetConfigSource(), typeof(Post), typeof(Blog));

            using (new SessionScope())
            {
                Recreate();

                Post.DeleteAll();
                Blog.DeleteAll();

                var blogs = Blog.Queryable;
                Assert.IsNotNull(blogs);
                Assert.AreEqual(0, blogs.Count());

                Blog blog = new Blog();
                blog.Name = "hammett's blog";
                blog.Author = "hamilton verissimo";
                blog.Create();

                Assert.AreEqual(1, (from b in Blog.Queryable select b).Count());

                blogs = Blog.Queryable;
                Assert.AreEqual(blog.Name, blogs.First().Name);
                Assert.AreEqual(blog.Author, blogs.First().Author);

                blog.Name = "something else1";
                blog.Author = "something else2";
                blog.Update();

                blogs = Blog.Queryable;
                Assert.IsNotNull(blogs);
                Assert.AreEqual(1, Blog.Queryable.Count());
                Assert.AreEqual(blog.Name, blogs.First().Name);
                Assert.AreEqual(blog.Author, blogs.First().Author);
            }
        }
开发者ID:stasizb,项目名称:ActiveRecord,代码行数:37,代码来源:ActiveRecordLinqTestCase.cs

示例6: SimpleOperations2

        public void SimpleOperations2()
        {
            Blog[] blogs = Blog.FindAll();

            Assert.IsNotNull(blogs);
            Assert.AreEqual(0, blogs.Length);

            Blog blog = new Blog();
            blog.Name = "hammett's blog";
            blog.Author = "hamilton verissimo";
            blog.Create();

            blogs = Blog.FindAll();
            Assert.AreEqual(blog.Name, blogs[0].Name);
            Assert.AreEqual(blog.Author, blogs[0].Author);

            Assert.IsNotNull(blogs);
            Assert.AreEqual(1, blogs.Length);

            blog.Name = "something else1";
            blog.Author = "something else2";
            blog.Update();

            blogs = Blog.FindAll();

            Assert.IsNotNull(blogs);
            Assert.AreEqual(1, blogs.Length);
            Assert.AreEqual(blog.Name, blogs[0].Name);
            Assert.AreEqual(blog.Author, blogs[0].Author);
        }
开发者ID:zhoufoxcn,项目名称:ActiveRecord,代码行数:30,代码来源:ActiveRecordGenericsTestCase.cs


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