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


C# IBlogRepository类代码示例

本文整理汇总了C#中IBlogRepository的典型用法代码示例。如果您正苦于以下问题:C# IBlogRepository类的具体用法?C# IBlogRepository怎么用?C# IBlogRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: BlogController

 /// <summary>
 /// Initializes a new instance of the <see cref="BlogController" /> class.
 /// </summary>
 /// <param name="blogRepository">The blog post repository.</param>
 /// <param name="commentRepository">The Disqus comment repository</param>
 /// <param name="urlShortener">The URL shortener</param>
 /// <param name="socialManager">The social network manager used to get sharing URLs</param>
 public BlogController(IBlogRepository blogRepository, IDisqusCommentRepository commentRepository, IUrlShortener urlShortener, ISocialManager socialManager)
 {
     _blogRepository = blogRepository;
     _commentRepository = commentRepository;
     _urlShortener = urlShortener;
     _socialManager = socialManager;
 }
开发者ID:Daniel15,项目名称:Website,代码行数:14,代码来源:BlogController.cs

示例2: WidgetViewModel

 public WidgetViewModel(IBlogRepository repository)
 {
     _repository = repository;
     Categories = _repository.Categories();
     Tags = _repository.Tags();
     LatestPosts = _repository.Posts(0, 10).ToList();
 }
开发者ID:silne30,项目名称:TPCv3,代码行数:7,代码来源:WidgetViewModel.cs

示例3: CreateManager

        public static IBlogManager CreateManager(IBlogRepository repository = null,
            IDbConnectionFactory connectionFactory = null)
        {
            if (repository == null)
                repository = new BlogRepository();

            if (connectionFactory == null && repository.DbFactory == null)
            {
                if (ConfigurationManager.ConnectionStrings["BlogDB"] == null)
                {
                    connectionFactory =
                        new OrmLiteConnectionFactory(
                            ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString,
                            SqlServerOrmLiteDialectProvider.Instance);
                    repository.DbFactory = connectionFactory;
                }
                else
                {
                    connectionFactory =
                        new OrmLiteConnectionFactory(
                            ConfigurationManager.ConnectionStrings["BlogDB"].ConnectionString,
                            SqlServerOrmLiteDialectProvider.Instance);

                    repository.DbFactory = connectionFactory;
                }
            }

            return new BlogManager
            {
                BlogRepo = repository
            };
        }
开发者ID:Kgrohs,项目名称:JustBlogging,代码行数:32,代码来源:BlogManagerFactory.cs

示例4: SetUp

 public void SetUp()
 {
     blogRP = MockRepository.GenerateMock<IBlogRepository>();
     postRP = MockRepository.GenerateMock<IPostRepository>();
     userRP = MockRepository.GenerateMock<IUserRepository>();
     friendlyUrlGen = MockRepository.GenerateMock<IFriendlyUrlGenerator>();
 }
开发者ID:DogaOztuzun,项目名称:BlogSharp,代码行数:7,代码来源:DefaultStartupInstallerTests.cs

示例5: ListViewModel

 public ListViewModel(IBlogRepository _blogRepository, int page)
 {
     currentPage = page;
     Posts = _blogRepository.Posts(page - 1, split);
     TotalPosts = _blogRepository.TotalPosts();
     totalPages = (int)Math.Ceiling((double)TotalPosts / (double)split);
 }
开发者ID:daliwei,项目名称:ProgramingTraffic,代码行数:7,代码来源:ListViewModel.cs

示例6: MyBlogsPresenter

 public MyBlogsPresenter()
 {
     _webContext = ObjectFactory.GetInstance<IWebContext>();
     _blogRepository = ObjectFactory.GetInstance<IBlogRepository>();
     _redirector = ObjectFactory.GetInstance<IRedirector>();
     _userSession = ObjectFactory.GetInstance<IUserSession>();
 }
开发者ID:SPKT,项目名称:MHX2,代码行数:7,代码来源:MyBlogsPresenter.cs

示例7: InsertTestData

        private void InsertTestData(IBlogRepository repository)
        {
            var ayende = new User {Name = "ayende"};
            var mythz = new User {Name = "mythz"};

            repository.StoreUsers(ayende, mythz);

            var ayendeBlog = ayende.CreateNewBlog(new Blog { Tags = { "Architecture", ".NET", "Databases" } });

            var mythzBlog = mythz.CreateNewBlog(new Blog { Tags = { "Architecture", ".NET", "Databases" } });

            ayendeBlog.StoreNewBlogPosts(new BlogPost
            {
                Title = "RavenDB",
                Categories = new List<string> { "NoSQL", "DocumentDB" },
                Tags = new List<string> { "Raven", "NoSQL", "JSON", ".NET" },
                Comments = new List<BlogPostComment>
					{
						new BlogPostComment { Content = "First Comment!", CreatedDate = DateTime.UtcNow,},
						new BlogPostComment { Content = "Second Comment!", CreatedDate = DateTime.UtcNow,},
					}
            },
                new BlogPost
                {
                    BlogId = ayendeBlog.Id,
                    Title = "Cassandra",
                    Categories = new List<string> { "NoSQL", "Cluster" },
                    Tags = new List<string> { "Cassandra", "NoSQL", "Scalability", "Hashing" },
                    Comments = new List<BlogPostComment>
					{
						new BlogPostComment { Content = "First Comment!", CreatedDate = DateTime.UtcNow,}
					}
                });

            mythzBlog.StoreNewBlogPosts(
                new BlogPost
                {
                    Title = "Redis",
                    Categories = new List<string> { "NoSQL", "Cache" },
                    Tags = new List<string> { "Redis", "NoSQL", "Scalability", "Performance" },
                    Comments = new List<BlogPostComment>
					{
						new BlogPostComment { Content = "First Comment!", CreatedDate = DateTime.UtcNow,}
					}
                },
                new BlogPost
                {
                    Title = "Couch Db",
                    Categories = new List<string> { "NoSQL", "DocumentDB" },
                    Tags = new List<string> { "CouchDb", "NoSQL", "JSON" },
                    Comments = new List<BlogPostComment>
					{
						new BlogPostComment {Content = "First Comment!", CreatedDate = DateTime.UtcNow,}
					}
                });




        }
开发者ID:hgirish,项目名称:MyServiceStack.Redis,代码行数:60,代码来源:BlogPostBestPractice.cs

示例8: SetUp

        public void SetUp()
        {
            mockedAuthenticationService = MockRepository.GenerateMock<IAuthenticationService>();
            mockedBlogRepository = MockRepository.GenerateMock<IBlogRepository>();

            sut = new AdminController(mockedAuthenticationService, mockedBlogRepository);
        }
开发者ID:Beton,项目名称:Blog4Net,代码行数:7,代码来源:AdminControllerTests.cs

示例9: BlogController

        public BlogController(IBlogRepository blogRepository, ApplicationUserManager userManager, ApplicationSignInManager signInManager)
        {
            _blogRepository = blogRepository;
            UserManager = userManager;
            SignInManager = signInManager;

        }
开发者ID:erdemnayir,项目名称:Mvc5Project,代码行数:7,代码来源:BlogController.cs

示例10: HomeModule

        public HomeModule(IBlogRepository blogRepository)
        {
            _blogRepository = blogRepository;

            Get["/"] = parameters => View["Index"];

            Get["/blog/page/{pagenumber}"] = parameters =>
                                                            {
                                                                int pageNumber = parameters.pagenumber ?? 1;

                                                                Paged<Post> model = _blogRepository.GetBlogUrlFriendlyPosts(Domain, pageNumber);

                                                                return View["Blog", model];
                                                            };

            Get["/blog/{title}"] = parameters =>
                                                            {
                                                                string title = (string)parameters.title;

                                                                Post model = _blogRepository.GetPost(title, Domain);

                                                                return View["BlogDetail", model];
                                                            };
            //I know you can do Get[""] = ReturnTagModelAndView; but its hard to tell which route is being invoked
            Get["/blog/tag/{tagname}"] = parameters => ReturnTagModelAndView(parameters);

            Get["/blog/tag/{tagname}/page/{pagenumber}"] = parameters => ReturnTagModelAndView(parameters);

            Get["/blog/rss"] = parameters =>
                                   {
                                       //return first page
                                       Paged<Post> model = _blogRepository.GetBlogUrlFriendlyPosts(Domain, 1);
                                       return Response.AsRSS(model.Data, "My Blog");
                                   };
        }
开发者ID:jchannon,项目名称:SugarTown,代码行数:35,代码来源:HomeModule.cs

示例11: FeedController

 /// <summary>
 /// Initializes a new instance of the <see cref="FeedController" /> class.
 /// </summary>
 /// <param name="blogRepository">The blog repository.</param>
 /// <param name="projectRepository">Project repository</param>
 /// <param name="siteConfig">Site configuration</param>
 /// <param name="urlShortener">URL shortener</param>
 public FeedController(IBlogRepository blogRepository, IProjectRepository projectRepository, ISiteConfiguration siteConfig, IUrlShortener urlShortener)
 {
     _blogRepository = blogRepository;
     _projectRepository = projectRepository;
     _siteConfig = siteConfig;
     _urlShortener = urlShortener;
 }
开发者ID:xb11,项目名称:Website,代码行数:14,代码来源:FeedController.cs

示例12: HomeController

        public HomeController(IBlogRepository blogRepository)
        {
            if (blogRepository == null)
                throw new ArgumentNullException("blogRepository");

            this.blogRepository = blogRepository;
        }
开发者ID:RobinHames,项目名称:CacheProvider,代码行数:7,代码来源:HomeController.cs

示例13: WidgetViewModel

 public WidgetViewModel(IBlogRepository repo)
 {
     Categories = repo.GetCategories();
     Tags = repo.GetTags();
     LatestPosts = repo.GetPosts()
                     .Take(ConfigUtil.ReadFromConfig(Constants.LATEST_POSTS_COUNT))
                     .ToList<Post>();
 }
开发者ID:sundeepkamath,项目名称:MyBlog,代码行数:8,代码来源:WidgetViewModel.cs

示例14: ListPostViewModel

 public ListPostViewModel(IBlogRepository blogRepository, int pageNo)
 {
     _blogRepository = blogRepository;
     Posts = _blogRepository.Posts(pageNo - 1, itemsPerPage);
     TotalPosts = _blogRepository.TotalPosts();
     PagingInfo = new PagingInfo
                      {CurrentPage = pageNo, ItemsPerPage = itemsPerPage, TotalItems = TotalPosts};
 }
开发者ID:silne30,项目名称:TPCv3,代码行数:8,代码来源:ListPostViewModel.cs

示例15: BlogController

 /// <summary>
 /// Initializes a new instance of the <see cref="BlogController" /> class.
 /// </summary>
 /// <param name="blogRepository">The blog repository.</param>
 /// <param name="tempDataProvider">The temporary data provider</param>
 /// <param name="webCache">Web cache to clear when modifying posts</param>
 /// <param name="comments">Disqus comments service</param>
 public BlogController(IBlogRepository blogRepository, ITempDataProvider tempDataProvider, IWebCache webCache, IDisqusComments comments)
 {
     _blogRepository = blogRepository;
     _webCache = webCache;
     _comments = comments;
     // TODO: This shouldn't be required to be passed in the constructor - Can set it as a property.
     TempDataProvider = tempDataProvider;
 }
开发者ID:TobiasWooldridge,项目名称:Website,代码行数:15,代码来源:BlogController.cs


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