本文整理汇总了C#中IBlogRepository类的典型用法代码示例。如果您正苦于以下问题:C# IBlogRepository类的具体用法?C# IBlogRepository怎么用?C# IBlogRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IBlogRepository类属于命名空间,在下文中一共展示了IBlogRepository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: PostPresenter
public PostPresenter()
{
_blogRepository = ObjectFactory.GetInstance<IBlogRepository>();
_webContext = ObjectFactory.GetInstance<IWebContext>();
_userSession = ObjectFactory.GetInstance<IUserSession>();
_redirector = ObjectFactory.GetInstance<IRedirector>();
_alertService = ObjectFactory.GetInstance<IAlertService>();
}
开发者ID:SPKT,项目名称:MHX2,代码行数:8,代码来源:PostPresenter.cs
示例17: NewslettersController
public NewslettersController(IFeatureRepository featureRepository, INewsletterRepository newsletterRepository, INewsletterSubscriberRepository newsletterSubscriberRepository, IBlogPostRepository blogPostRepository, IBlogRepository blogRepository, IUserRepository userRepository)
: base(userRepository)
{
_blogPostRepository = blogPostRepository;
_newsletterSubscriberRepository = newsletterSubscriberRepository;
_newsletterService = new NewsletterService(newsletterRepository);
_blogRepository = blogRepository;
}
开发者ID:terjetyl,项目名称:epicserver,代码行数:8,代码来源:NewslettersController.cs
示例18: Under_These_Conditions
public override void Under_These_Conditions()
{
repository = IoC.Resolve<IBlogRepository>();
var blog = new BlogEntity {Host = "localhost"};
Repository<BlogEntity>.SaveOrUpdate(blog);
UnitOfWork.Current.Flush();
}
开发者ID:bclubb,项目名称:yabe,代码行数:9,代码来源:When_Fetching_A_Blog_With_A_Host_And_The_Blog_Is_In_The_Database.cs
示例19: 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>
/// <param name="siteConfig">Site configuration</param>
public BlogController(IBlogRepository blogRepository, IDisqusCommentRepository commentRepository, IUrlShortener urlShortener, ISocialManager socialManager, ISiteConfiguration siteConfig)
{
_blogRepository = blogRepository;
_commentRepository = commentRepository;
_urlShortener = urlShortener;
_socialManager = socialManager;
_siteConfig = siteConfig;
_profiler = MiniProfiler.Current;
}
开发者ID:TobiasWooldridge,项目名称:Website,代码行数:17,代码来源:BlogController.cs
示例20: DevelopmentService
public DevelopmentService(IBlogRepository blogRepository, IReleaseRepository releaseRepository,
IProjectRepository projectRepository)
{
_blogRepository = blogRepository;
_releaseRepository = releaseRepository;
_projectRepositry = projectRepository;
_dataAggregator = new DataAggregator();
}
开发者ID:jonathanody,项目名称:MVCDashboard,代码行数:9,代码来源:DevelopmentService.cs
注:本文中的IBlogRepository类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论