BlogSharp.Core.Impl.Installers.DefaultStartupInstaller.Execute C# (CSharp) Method

Execute() public method

Executes the default install.
public Execute ( ) : void
return void
        public void Execute()
        {
            if (isInitialized)
            {
                return;
            }

            var blog = blogRepository.GetBlog();
            if (blog != null)
            {
                isInitialized = true;
                return;
            }

            var user = new User
                       	{
                       		UserName = "BlogSharp",
                       		Password = "BlogSharp",
                       		Email = "[email protected]",
                       		ID = 1
                       	};

            blog = new Blog
                   	{
                   		ID = 1,
                   		Title = "BlogSharp Blogs",
                   		Founder = user,
                   		Configuration = new BlogConfiguration {PageSize = 10},
                   		Host = "localhost",
                   		Name = "BlogSharp",
                   	};
            blog.AddWriter(user);
            var tag = new Tag {ID = 1, Name = "Welcome", FriendlyName = "welcome"};
            var title = "Welcome to BlogSharp!";
            var post = new Post
                       	{
                       		ID = 1,
                       		Blog = blog,
                       		Publisher = user,
                       		Title = title,
                       		Content = "Great blog post is here you are.",
                       		FriendlyTitle = generator.GenerateUrl("{0}", title),
                       		DateCreated = DateTime.Now,
                       		DatePublished = DateTime.Now
                       	};
            tag.AddPost(post);
            blog.Configuration = new BlogConfiguration {PageSize = 10};
            blog.AddPost(post);
            userRepository.SaveUser(user);
            blogRepository.SaveBlog(blog);
            postRepository.SavePost(post);
            isInitialized = true;
        }
DefaultStartupInstaller