zoukankan      html  css  js  c++  java
  • BlogEngine.netBusinessBase

    最近总想学点什么来提升自己,由此我开始学习BlogEngine,嘿嘿。

    http://www.cnblogs.com/Thriving-Country/archive/2008/11/04/1326334.html 这是一个大大写的相关文章,就是版本老了点,

    但是原理相通么,呵呵。我下了BlogEngine.net 2.5版本的。

    好了,开始旅程。

    打开工程,首先运行一遍,然后我就想从哪开始看,头大啊,好在有别人写的东西做参考,省了很多时间。

    在工程里有一个叫做BusinessBase的基类,其他所有的功能都是基于这个类进行展开的,不废话了,这些别人都已说过,我的重点是分析代码。

    BusinessBase
    1  public abstract class BusinessBase<T, TKey> : IDataErrorInfo, INotifyPropertyChanged, INotifyPropertyChanging, IChangeTracking, IDisposable
    2 where T : BusinessBase<T, TKey>, new()

    这是一个泛型类,实现了好多接口啊!IDataErrorInfo, INotifyPropertyChanged, INotifyPropertyChanging, IChangeTracking, IDisposable
    除了IDisposable,其他都是System.dll里的,看下这些接口都是些什么。

    IDataErrorInfo
     1 // Summary:
    2 // Provides the functionality to offer custom error information that a user
    3 // interface can bind to.
    4 public interface IDataErrorInfo
    5 {
    6 // Summary:
    7 // Gets an error message indicating what is wrong with this object.
    8 //
    9 // Returns:
    10 // An error message indicating what is wrong with this object. The default is
    11 // an empty string ("").
    12 string Error { get; }
    13
    14 // Summary:
    15 // Gets the error message for the property with the given name.
    16 //
    17 // Parameters:
    18 // columnName:
    19 // The name of the property whose error message to get.
    20 //
    21 // Returns:
    22 // The error message for the property. The default is an empty string ("").
    23 string this[string columnName] { get; }
    24 }
    INotifyPropertyChanged
    1 // Summary:
    2 // Notifies clients that a property value has changed.
    3 public interface INotifyPropertyChanged
    4 {
    5 // Summary:
    6 // Occurs when a property value changes.
    7 event PropertyChangedEventHandler PropertyChanged;
    8 }
    INotifyPropertyChanging
    1 // Summary:
    2 // Notifies clients that a property value is changing.
    3 public interface INotifyPropertyChanging
    4 {
    5 // Summary:
    6 // Occurs when a property value is changing.
    7 event PropertyChangingEventHandler PropertyChanging;
    8 }
    IChangeTracking
     1 // Summary:
    2 // Defines the mechanism for querying the object for changes and resetting of
    3 // the changed status.
    4 public interface IChangeTracking
    5 {
    6 // Summary:
    7 // Gets the object's changed status.
    8 //
    9 // Returns:
    10 // true if the object’s content has changed since the last call to System.ComponentModel.IChangeTracking.AcceptChanges();
    11 // otherwise, false.
    12 bool IsChanged { get; }
    13
    14 // Summary:
    15 // Resets the object’s state to unchanged by accepting the modifications.
    16 void AcceptChanges();
    17 }

    看了下,原来也没多少,什么错误消息,属性改变事件相关的东西。
    回到BusinessBase 这个类,才发现包含了大量的公共属性,方法,我是不是说了句废话.....

    看下面的类关系图


    好家伙,下面有7个儿子呢。看看这些儿子们是分别干什么的吧。
    AuthorProfile 用户注册信息
    Blog             代表一个博客实例
    BlogRollItem 博客友情链接
    Page            静态页面信息
    Referrer       反向链接信息
    Post            提交的一篇文章信息
    Category     文章种类

    至于细节方面实在太多,再说再说。

  • 相关阅读:
    JDBC事务--软件开发三层架构--ThreadLocal
    SQL查询-约束-多表
    SQL基本语法总结
    DDL
    ZOJ 1178 Booklet Printing
    ZOJ 1107 FatMouse and Cheese
    ZOJ 1099 HTML
    ZOJ 1041 Transmitters
    ZOJ 1095 Humble Numbers
    ZOJ 1105 FatMouse’s Tour
  • 原文地址:https://www.cnblogs.com/whosedream/p/2251111.html
Copyright © 2011-2022 走看看