温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:LiveBlog v1.0测试版源码
当前文件:
LiveBlog/LiveBlog.Core/Comment.cs,打开代码结构图
LiveBlog/LiveBlog.Core/Comment.cs,打开代码结构图1Using#region Using 2
3
using System; 4
using System.Globalization; 5
using System.Collections.Generic; 6
using System.ComponentModel; 7
8
#endregion 9
10
namespace LiveBlog.Core 11
...{ 12
/**//// <summary> 13
/// Represents a comment to a blog post. 14
/// </summary> 15
[Serializable] 16
public sealed class Comment : IComparable<Comment>, IPublishable 17
...{ 18
19
Properties#region Properties 20
21
private Guid _Id; 22
/**//// <summary> 23
/// The Id of the comment. 24
/// </summary> 25
public Guid Id 26
...{ 27
get ...{ return _Id; } 28
set ...{ _Id = value; } 29
} 30
31
private string _Author; 32
/**//// <summary> 33
/// Gets or sets the author. 34
/// </summary> 35
/// <value>The author.</value> 36
public string Author 37
...{ 38
get ...{ return _Author; } 39
set ...{ _Author = value; } 40
} 41
42
private string _Email; 43
/**//// <summary> 44
/// Gets or sets the email. 45
/// </summary> 46
/// <value>The email.</value> 47
public string Email 48
...{ 49
get ...{ return _Email; } 50
set ...{ _Email = value; } 51
} 52
53
private Uri _Website; 54
55
/**//// <summary> 56
/// Gets or sets the website. 57
/// </summary> 58
/// <value>The website.</value> 59
public Uri Website 60
...{ 61
get ...{ return _Website; } 62
set ...{ _Website = value; } 63
} 64
65
private string _Content; 66
/**//// <summary> 67
/// Gets or sets the content. 68
/// </summary> 69
/// <value>The content.</value> 70
public string Content 71
...{ 72
get ...{ return _Content; } 73
set ...{ _Content = value; } 74
} 75
76
private string _Country; 77
/**//// <summary> 78
/// Gets or sets the country. 79
/// </summary> 80
/// <value>The country.</value> 81
public string Country 82
...{ 83
get ...{ return _Country; } 84
set ...{ _Country = value; } 85
} 86
87
private string _IP; 88
/**//// <summary> 89
/// Gets or sets the IP address. 90
/// </summary> 91
/// <value>The IP.</value> 92
public string IP 93
...{ 94
get ...{ return _IP; } 95
set ...{ _IP = value; } 96
} 97
98
private IPublishable _Post; 99
100
/**//// <summary> 101
/// 102
/// </summary> 103
public IPublishable Parent 104
...{ 105
get ...{ return _Post; } 106
set ...{ _Post = value; } 107
} 108
109
private bool _IsApproved; 110
/**//// <summary> 111
/// Gets or sets the Comment approval status 112
/// </summary> 113
public bool IsApproved 114
...{ 115
get ...{ return _IsApproved; } 116
set ...{ _IsApproved = value; } 117
} 118
119
/**//// <summary> 120
/// Gets whether or not this comment should be shown 121
/// </summary> 122
/// <value></value> 123
public bool IsVisible 124
...{ 125
get ...{ return IsApproved; } 126
} 127
128
private DateTime _DateCreated = DateTime.MinValue; 129
/**//// <summary> 130
/// Gets or sets when the comment was created. 131
/// </summary> 132
public DateTime DateCreated 133
...{ 134
get 135
...{ 136
if (_DateCreated == DateTime.MinValue) 137
return _DateCreated; 138
139
return _DateCreated.AddHours(BlogSettings.Instance.Timezone); 140
141
} 142
set ...{ _DateCreated = value; } 143
} 144
145
DateTime IPublishable.DateModified 146
...{ 147
get ...{ return DateCreated; } 148
} 149
150
/**//// <summary> 151
/// Gets the title of the object 152
/// </summary> 153
/// <value></value> 154
public String Title 155
...{ 156
get ...{ return Author + " on " + Parent.Title; } 157
} 158
159
/**//// <summary> 160
/// Gets the relative link of the comment. 161
/// </summary> 162
/// <value>The relative link.</value> 163
public string RelativeLink 164
...{ 165
get ...{ return Parent.RelativeLink.ToString() + "#id_" + Id; } 166
} 167
168
/**//// <summary> 169
/// Gets the absolute link. 170
/// </summary> 171
/// <value>The absolute link.</value> 172
public Uri AbsoluteLink 173
...{ 174
get ...{ return new Uri(Parent.AbsoluteLink + "#id_" + Id); } 175
} 176
177
/**//// <summary> 178
/// Gets the description. Returns always string.empty. 179
/// </summary> 180
/// <value>The description.</value> 181
public String Description 182
...{ 183
get ...{ return string.Empty; } 184
} 185
186
StateList<Category> IPublishable.Categories 187
...{ 188
get ...{ return null; } 189
} 190
191
#endregion 192
193
IComparable
Members #region IComparable<Comment> Members 194195
/**//// <summary> 196
/// Compares the current object with another object of the same type. 197
/// </summary> 198
/// <param name="other">An object to compare with this object.</param> 199
/// <returns> 200
/// A 32-bit signed integer that indicates the relative order of the 201
/// objects being compared. The return value has the following meanings: 202
/// Value Meaning Less than zero This object is less than the other parameter. 203
/// Zero This object is equal to other. Greater than zero This object is greater than other. 204
/// </returns> 205
public int CompareTo(Comment other) 206
...{ 207
return this.DateCreated.CompareTo(other.DateCreated); 208
} 209
210
#endregion 211
212
Events#region Events 213
214
/**//// <summary> 215
/// Occurs when the post is being served to the output stream. 216
/// </summary> 217
public static event EventHandler<ServingEventArgs> Serving; 218
/**//// <summary> 219
/// Raises the event in a safe way 220
/// </summary> 221
public static void OnServing(Comment comment, ServingEventArgs arg) 222
...{ 223
if (Serving != null) 224




