温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:LiveBlog v1.0测试版源码
当前文件:
LiveBlog/LiveBlog.Core/Providers/BlogProvider.cs,打开代码结构图
LiveBlog/LiveBlog.Core/Providers/BlogProvider.cs,打开代码结构图1Using 10
11
namespace LiveBlog.Core.Providers 12
{ 13
/// <summary> 14
/// A base class for all custom providers to inherit from. 15
/// </summary> 16
public abstract class BlogProvider : ProviderBase 17
{ 18
// Post 19
/// <summary> 20
/// Retrieves a Post from the provider based on the specified id. 21
/// </summary> 22
public abstract Post SelectPost(Guid id); 23
/// <summary> 24
/// Inserts a new Post into the data store specified by the provider. 25
/// </summary> 26
public abstract void InsertPost(Post post); 27
/// <summary> 28
/// Updates an existing Post in the data store specified by the provider. 29
/// </summary> 30
public abstract void UpdatePost(Post post); 31
/// <summary> 32
/// Deletes a Post from the data store specified by the provider. 33
/// </summary> 34
public abstract void DeletePost(Post post); 35
/// <summary> 36
/// Retrieves all Posts from the provider and returns them in a List. 37
/// </summary> 38
public abstract List<Post> FillPosts(); 39
40
// Page 41
/// <summary> 42
/// Retrieves a Page from the provider based on the specified id. 43
/// </summary> 44
public abstract Page SelectPage(Guid id); 45
/// <summary> 46
/// Inserts a new Page into the data store specified by the provider. 47
/// </summary> 48
public abstract void InsertPage(Page page); 49
/// <summary> 50
/// Updates an existing Page in the data store specified by the provider. 51
/// </summary> 52
public abstract void UpdatePage(Page page); 53
/// <summary> 54
/// Deletes a Page from the data store specified by the provider. 55
/// </summary> 56
public abstract void DeletePage(Page page); 57
/// <summary> 58
/// Retrieves all Pages from the provider and returns them in a List. 59
/// </summary> 60
public abstract List<Page> FillPages(); 61
62
/// <summary> 63
/// Retrieves a Category from the provider based on the specified id. 64
/// </summary> 65
public abstract Category SelectCategory(Guid id); 66
/// <summary> 67
/// Inserts a new Category into the data store specified by the provider. 68
/// </summary> 69
public abstract void InsertCategory(Category category); 70
/// <summary> 71
/// Updates an existing Category in the data store specified by the provider. 72
/// </summary> 73
public abstract void UpdateCategory(Category category); 74
/// <summary> 75
/// Deletes a Category from the data store specified by the provider. 76
/// </summary> 77
public abstract void DeleteCategory(Category category); 78
/// <summary> 79
/// Retrieves all Categories from the provider and returns them in a List. 80
/// </summary> 81
public abstract List<Category> FillCategories(); 82
83
// Settings 84
/// <summary> 85
/// Loads the settings from the provider. 86
/// </summary> 87
public abstract StringDictionary LoadSettings(); 88
/// <summary> 89
/// Saves the settings to the provider. 90
/// </summary> 91
public abstract void SaveSettings(StringDictionary settings); 92
93
//Ping services 94
/// <summary> 95
/// Loads the ping services. 96
/// </summary> 97
/// <returns></returns> 98
public abstract StringCollection LoadPingServices(); 99
/// <summary> 100
/// Saves the ping services. 101
/// </summary> 102
/// <param name="services">The services.</param> 103
public abstract void SavePingServices(StringCollection services); 104
105
} 106
107
/// <summary> 108
/// A collection of all registered providers. 109
/// </summary> 110
public class BlogProviderCollection : ProviderCollection 111
{ 112
/// <summary> 113
/// Gets a provider by its name. 114
/// </summary> 115
public new BlogProvider this[string name] 116
{ 117
get { return (BlogProvider)base[name]; } 118
} 119
120
/// <summary> 121
/// Add a provider to the collection. 122
/// </summary> 123
public override void Add(ProviderBase provider) 124
{ 125
if (provider == null) 126
throw new ArgumentNullException("provider"); 127
128
if (!(provider is BlogProvider)) 129
throw new ArgumentException 130
("Invalid provider type", "provider"); 131
132
base.Add(provider); 133
} 134
} 135
136
} 137





