本文整理汇总了C#中Blog类的典型用法代码示例。如果您正苦于以下问题:C# Blog类的具体用法?C# Blog怎么用?C# Blog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Blog类属于命名空间,在下文中一共展示了Blog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: BlogForm
public BlogForm(Blog blog) : this()
{
currentBlog = blog;
nameText.Text = currentBlog.Name;
authorText.Text = currentBlog.Author;
}
开发者ID:ralescano,项目名称:castle,代码行数:7,代码来源:BlogForm.cs
示例2: TestMethod1
public void TestMethod1()
{
BlogMapper m = new BlogMapper();
Blog b = new Blog();
m.Insert(b);
b = m.Get(1);
}
开发者ID:sandrapatfer,项目名称:PROMPT11-05-DataAccess.sandrapatfer,代码行数:7,代码来源:UnitTest1.cs
示例3: BlogEntry_is_Added_to_Blog
public void BlogEntry_is_Added_to_Blog()
{
var blogEntry = new BlogEntry(string.Empty);
var blog = new Blog();
blog.Add(blogEntry);
Assert.AreEqual(1, blog.Entries.Count());
}
开发者ID:DotNetHH,项目名称:blogKata,代码行数:7,代码来源:Class1.cs
示例4: SimpleOperations
public void SimpleOperations()
{
ActiveRecordStarter.Initialize(GetConfigSource(), typeof(Post), typeof(Blog));
Recreate();
Post.DeleteAll();
Blog.DeleteAll();
var blogs = from b in Blog.Queryable select b;
Assert.IsNotNull(blogs);
Assert.AreEqual(0, blogs.Count());
var blog = new Blog
{
Name = "hammett's blog",
Author = "hamilton verissimo"
};
blog.Save();
blogs = from b in Blog.Queryable select b;
Assert.IsNotNull(blogs);
Assert.AreEqual(1, blogs.Count());
var retrieved = Blog.Queryable.First();
Assert.IsNotNull(retrieved);
Assert.AreEqual(blog.Name, retrieved.Name);
Assert.AreEqual(blog.Author, retrieved.Author);
}
开发者ID:oillio,项目名称:Castle.ActiveRecord,代码行数:34,代码来源:ActiveRecordLinqTestCase.cs
示例5: BlogRelatedViewModel
public BlogRelatedViewModel(string title)
{
using (var context = new DataContext())
{
// Try permalink first
TheBlog = context.Blogs.FirstOrDefault(x => x.PermaLink == title);
MaxBlogCount = BlogListModel.GetBlogSettings().MaxBlogsOnHomepageBeforeLoad;
// If no go then try title as a final back up
if (TheBlog == null)
{
title = title.Replace(Utils.ContentGlobals.BLOGDELIMMETER, " ");
TheBlog = context.Blogs.FirstOrDefault(x => x.Title == title);
}
if (TheBlog != null && TheBlog.Tags != null)
{
List<string> tags = TheBlog.Tags.Split(',').ToList();
RelatedPosts = context.Blogs.Where(x => x.BlogId != TheBlog.BlogId && tags.Contains(x.Tags) && x.MainCategory == TheBlog.MainCategory)
.OrderByDescending(blog => blog.Date)
.Take(MaxBlogCount)
.ToList();
if (RelatedPosts.Count > 0)
{
LastBlogId = RelatedPosts.LastOrDefault().BlogId;
}
}
}
}
开发者ID:marciocamello,项目名称:dirigo-edge,代码行数:31,代码来源:BlogRelatedViewModel.cs
示例6: dummy
void dummy()
{
BlogMapper m = new BlogMapper();
Blog b = new Blog();
m.Insert(b);
b = m.Get(1);
}
开发者ID:sandrapatfer,项目名称:PROMPT11-05-DataAccess.sandrapatfer,代码行数:7,代码来源:DataService.cs
示例7: Main
static void Main(string[] args)
{
Author author = new Author();
author.FullName = "Gang of Four";
author.Age = 22;
Blog blog = new Blog();
blog.Id = 1;
blog.Name = "Design Patterns";
blog.Comments.Add("Visitor pattern");
blog.Comments.Add("Abstract factory pattern");
blog.Comments.Add("Composite pattern");
blog.Author = author;
ISerializerFactory serializerFactory = new UnicodeXmlSerializerFactory();
var service = new BlogDataExchangeService();
service.SerializerFactory = serializerFactory;
System.Console.WriteLine("{0}:\n{1}\n", "Full as Unicode XML Document", service.GetFull(blog));
System.Console.WriteLine("{0}:\n{1}\n", "Header as Unicode XML Document", service.GetHeader(blog));
System.Console.WriteLine("{0}:\n{1}\n", "Exchange as Unicode XML Document", service.GetFullForExchange(blog));
System.Console.WriteLine();
serializerFactory = new JsonSerializerFactory();
service.SerializerFactory = serializerFactory;
System.Console.WriteLine("{0}:\n{1}\n", "Full as JSON Document", service.GetFull(blog));
System.Console.WriteLine("{0}:\n{1}\n", "Header as JSON Document", service.GetHeader(blog));
System.Console.WriteLine("{0}:\n{1}\n", "Exchange as JSON Document", service.GetFullForExchange(blog));
System.Console.WriteLine("Execution finished. Press a key to exit.");
System.Console.ReadLine();
}
开发者ID:pongracz-lajos,项目名称:serializer,代码行数:34,代码来源:Program.cs
示例8: GivenANewBlog_ThenItsLastUpdatedDateIsNow
public void GivenANewBlog_ThenItsLastUpdatedDateIsNow()
{
var blog = new Blog();
Assert.That(blog.LastUpdated, Is.LessThanOrEqualTo(DateTime.Now));
}
开发者ID:kevinrjones,项目名称:mblog,代码行数:7,代码来源:BlogTest.cs
示例9: CanPerformDynamicQueryAndGetValidResults
public void CanPerformDynamicQueryAndGetValidResults()
{
var blogOne = new Blog
{
Title = "one",
Category = "Ravens"
};
var blogTwo = new Blog
{
Title = "two",
Category = "Rhinos"
};
var blogThree = new Blog
{
Title = "three",
Category = "Rhinos"
};
db.Documents.Put("blogOne", null, RavenJObject.FromObject(blogOne), new RavenJObject(), null);
db.Documents.Put("blogTwo", null, RavenJObject.FromObject(blogTwo), new RavenJObject(), null);
db.Documents.Put("blogThree", null, RavenJObject.FromObject(blogThree), new RavenJObject(), null);
var results = db.ExecuteDynamicQuery(null,new IndexQuery()
{
PageSize = 128,
Start = 0,
Cutoff = SystemTime.UtcNow,
Query = "Title.Length:3 AND Category:Rhinos"
}, CancellationToken.None);
Assert.Equal(1, results.Results.Count);
Assert.Equal("two", results.Results[0].Value<string>("Title"));
Assert.Equal("Rhinos", results.Results[0].Value<string>("Category"));
}
开发者ID:ReginaBricker,项目名称:ravendb,代码行数:34,代码来源:ParameterizedDynamicQuery.cs
示例10: PostViewModel
public PostViewModel(Blog blog, Blogger blogger, Post post, List<Post> posts)
{
Post = post;
Blogger = blogger;
Blog = blog;
Posts = posts;
}
开发者ID:EvgenyR,项目名称:Website,代码行数:7,代码来源:PostViewModel.cs
示例11: BelongTo
public static void BelongTo(this IList<Post> posts, Blog blog)
{
foreach (Post postItem in posts)
{
postItem.Blog = blog;
}
}
开发者ID:juanonsoftware,项目名称:hichi,代码行数:7,代码来源:PostHelper.cs
示例12: SimpleOperations
public void SimpleOperations()
{
Assert.IsTrue(NHibernate.Cfg.Environment.UseReflectionOptimizer);
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.Save();
blogs = Blog.FindAll();
Assert.IsNotNull(blogs);
Assert.AreEqual(1, blogs.Length);
Blog retrieved = blogs[0];
Assert.IsNotNull(retrieved);
Assert.AreEqual(blog.Name, retrieved.Name);
Assert.AreEqual(blog.Author, retrieved.Author);
}
开发者ID:ralescano,项目名称:castle,代码行数:25,代码来源:ActiveRecordGenericsTestCase.cs
示例13: CreateBlog
private static void CreateBlog()
{
var blog = new Blog {BloggerName = "Julie", Title = "EF41 Blog", DateCreated=DateTime.Now};
//var blog = new Blog() { Title = "This is a blog with a really long blog title" };
var db = new Context();
db.Blogs.Add(blog);
try
{
db.SaveChanges();
}
catch (DbEntityValidationException ex)
{
foreach (var entityError in ex.EntityValidationErrors)
{
Console.WriteLine(entityError.Entry.Entity.GetType().Name);
foreach (var error in entityError.ValidationErrors)
{
Console.WriteLine("{0}: {1}", error.PropertyName, error.ErrorMessage);
}
}
Console.ReadKey();
}
}
开发者ID:atul221282,项目名称:Demo,代码行数:25,代码来源:Program.cs
示例14: FetchEnum_Join_on_a_HasMany_property_should_not_return_duplicate_records
public void FetchEnum_Join_on_a_HasMany_property_should_not_return_duplicate_records()
{
Blog[] blogs = Blog.FindAll();
Assert.IsNotNull(blogs);
Assert.AreEqual(0, blogs.Length);
var blog = new Blog() { Name = "Test blog", Author = "Eric Bowen" };
blog.Save();
var post = new Post(blog, "Post1", "Content1", "Category1");
post.Save();
blog.Posts.Add(post);
var post2 = new Post(blog, "Post2", "Content2", "Category2");
post2.Save();
blog.Posts.Add(post2);
blog.Save();
blogs = Blog.FindAll();
Assert.IsNotNull(blogs);
Assert.AreEqual(1, blogs.Length);
}
开发者ID:zhoufoxcn,项目名称:ActiveRecord,代码行数:28,代码来源:FetchTestCase.cs
示例15: EditBlogViewModel
public EditBlogViewModel(string blogId)
{
BlogId = Int32.Parse(blogId);
_memUser = Membership.GetUser(HttpContext.Current.User.Identity.Name);
SiteUrl = HTTPUtils.GetFullyQualifiedApplicationPath() + "blog/";
using (var context = new DataContext())
{
ThisBlog = context.Blogs.FirstOrDefault(x => x.BlogId == BlogId);
// Make sure we have a permalink set
if (String.IsNullOrEmpty(ThisBlog.PermaLink))
{
ThisBlog.PermaLink = ContentUtils.GetFormattedUrl(ThisBlog.Title);
context.SaveChanges();
}
// Get the list of Authors for the drop down select
BlogUsers = context.BlogUsers.Where(x => x.IsActive == true).OrderBy(x => x.DisplayName).ToList();
Categories = context.BlogCategories.Where(x => x.IsActive == true).ToList();
UsersSelectedCategories = new List<string>();
_thisUser = context.Users.FirstOrDefault(x => x.Username == _memUser.UserName);
}
// Get the admin modules that will be displayed to the user in each column
getAdminModules();
}
开发者ID:marciocamello,项目名称:dirigo-edge,代码行数:30,代码来源:EditBlogViewModel.cs
示例16: CanAddAndGetBlog
public void CanAddAndGetBlog()
{
Blog b1 = null;
try
{
// Arrange
b1 = new Blog("myblog", "My blog", "Blah ...", OwnerId1);
// Act
BlogRepository.Add(b1);
Blog b2 = BlogRepository.Get(b1.Id);
// Assert
Assert.IsNotNull(b2);
Assert.AreEqual(b1.Id, b2.Id);
Assert.AreNotEqual(b1.Id, Guid.Empty, "Persistence layer must assign IDs");
Assert.AreEqual(b1.Key, b2.Key);
Assert.AreEqual(b1.Title, b2.Title);
Assert.AreEqual(b1.Description, b2.Description);
Assert.AreEqual(b1.OwnerId, b2.OwnerId);
}
finally
{
BlogRepository.Remove(b1.Id);
}
}
开发者ID:JornWildt,项目名称:Xyperico.Blog,代码行数:27,代码来源:BlogRepositoryTests.cs
示例17: Article
internal Article(Blog blog, string uri, DateTime date, string title)
{
this.blog = blog;
this.uri = uri;
this.date = date;
this.title = title;
}
开发者ID:sinshu,项目名称:rss_uneune,代码行数:7,代码来源:Article.cs
示例18: Run
/// <summary>
/// Posts trackbacks and pingbacks for the specified entry.
/// </summary>
public static void Run(Entry entry, Blog blog, BlogUrlHelper urlHelper)
{
if (!blog.TrackbacksEnabled)
{
return;
}
if (!Config.Settings.Tracking.EnablePingBacks && !Config.Settings.Tracking.EnableTrackBacks)
{
return;
}
if (entry != null)
{
VirtualPath blogUrl = urlHelper.BlogUrl();
Uri fullyQualifiedUrl = blogUrl.ToFullyQualifiedUrl(blog);
var notify = new Notifier
{
FullyQualifiedUrl = fullyQualifiedUrl.AbsoluteUri,
BlogName = blog.Title,
Title = entry.Title,
PostUrl = urlHelper.EntryUrl(entry).ToFullyQualifiedUrl(blog),
Description = entry.HasDescription ? entry.Description : entry.Title,
Text = entry.Body
};
//This could take a while, do it on another thread
ThreadHelper.FireAndForget(notify.Notify, "Exception occured while attempting trackback notification");
}
}
开发者ID:jeremy-jameson,项目名称:Subtext,代码行数:34,代码来源:Notification.cs
示例19: AddBlog
public ActionResult AddBlog()
{
// Create a new blog to be passed to the edit blog action
Blog blog = new Blog
{
IsActive = false,
Title = "New Blog",
Date = DateTime.UtcNow,
Tags = new List<BlogTag> { Utils.GetNewBlogTag() },
BlogAuthor = Context.BlogUsers.First(usr => usr.UserId == 1) // This is anonymous and can't be deleted
};
var cat = Utils.GetUncategorizedCategory();
blog.Category = cat;
Context.Blogs.Add(blog);
Context.SaveChanges();
// Update the blog title / permalink with the new id we now have
var blogId = blog.BlogId.ToString();
blog.Title = blog.Title + " " + blogId;
Context.SaveChanges();
return RedirectToAction("EditBlog", "Blog", new { id = blogId });
}
开发者ID:codevlabs,项目名称:DirigoEdge,代码行数:26,代码来源:BlogController.cs
示例20: AuthenticateRequest
public void AuthenticateRequest(Blog blog, HttpContextBase context)
{
string authHeader = context.Request.Headers["Authorization"];
if(String.IsNullOrEmpty(authHeader))
{
return;
}
if(authHeader.IndexOf("Basic ") == 0)
{
byte[] bytes = Convert.FromBase64String(authHeader.Remove(0, 6));
string authString = Encoding.Default.GetString(bytes);
string[] usernamepassword = authString.Split(':');
if(context.Authenticate(blog, usernamepassword[0], usernamepassword[1], false))
{
context.User = new GenericPrincipal(new GenericIdentity(usernamepassword[0]), null);
}
else
{
SendAuthRequest(context);
}
}
}
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:25,代码来源:FormToBasicAuthenticationModule.cs
注:本文中的Blog类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论