本文整理汇总了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;
}
示例2: WidgetViewModel
public WidgetViewModel(IBlogRepository repository)
{
_repository = repository;
Categories = _repository.Categories();
Tags = _repository.Tags();
LatestPosts = _repository.Posts(0, 10).ToList();
}
示例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
};
}
示例4: SetUp
public void SetUp()
{
blogRP = MockRepository.GenerateMock<IBlogRepository>();
postRP = MockRepository.GenerateMock<IPostRepository>();
userRP = MockRepository.GenerateMock<IUserRepository>();
friendlyUrlGen = MockRepository.GenerateMock<IFriendlyUrlGenerator>();
}
示例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);
}
示例6: MyBlogsPresenter
public MyBlogsPresenter()
{
_webContext = ObjectFactory.GetInstance<IWebContext>();
_blogRepository = ObjectFactory.GetInstance<IBlogRepository>();
_redirector = ObjectFactory.GetInstance<IRedirector>();
_userSession = ObjectFactory.GetInstance<IUserSession>();
}
示例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,}
}
});
}
示例8: SetUp
public void SetUp()
{
mockedAuthenticationService = MockRepository.GenerateMock<IAuthenticationService>();
mockedBlogRepository = MockRepository.GenerateMock<IBlogRepository>();
sut = new AdminController(mockedAuthenticationService, mockedBlogRepository);
}
示例9: BlogController
public BlogController(IBlogRepository blogRepository, ApplicationUserManager userManager, ApplicationSignInManager signInManager)
{
_blogRepository = blogRepository;
UserManager = userManager;
SignInManager = signInManager;
}
示例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");
};
}
示例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;
}
示例12: HomeController
public HomeController(IBlogRepository blogRepository)
{
if (blogRepository == null)
throw new ArgumentNullException("blogRepository");
this.blogRepository = blogRepository;
}
示例13: WidgetViewModel
public WidgetViewModel(IBlogRepository repo)
{
Categories = repo.GetCategories();
Tags = repo.GetTags();
LatestPosts = repo.GetPosts()
.Take(ConfigUtil.ReadFromConfig(Constants.LATEST_POSTS_COUNT))
.ToList<Post>();
}
示例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};
}
示例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;
}