初步学习petshop
2006-04-21 23:37 Clingingboy 阅读(851) 评论(0) 编辑 收藏 举报项目 | 用途 |
BLL |
业务逻辑组件存放之处 |
ConfigTool |
用来加密连接字符串和创建事件日志源的管理应用程序 |
DALFactory |
用来确定加载哪一个数据库访问程序集的类 |
IDAL |
每个 DAL 实现都要实现的一组接口 |
Model |
瘦数据类或业务实体 |
OracleDAL |
Oracle 特定的 Pet Shop DAL 实现,使用了 IDAL 接口 |
Post-Build |
运行编译后操作的项目,比如将程序集添加到 GAC 或 COM+ |
Pre-Build |
将程序集从 GAC 删除或从 COM+ 注销程序集的项目 |
SQLServerDAL |
Microsoft SQL Server 特定的 Pet Shop DAL 实现,使用了 IDAL 接口 |
Utility |
一组帮助器类,包括 DPAPI 的包装 |
Web |
Web 页和控件 |
Solution Items |
用来构建应用程序的杂项,比如用来签署应用程序程序集的 Pet Shop.snk 密钥文件 |
SQLServerDAL项目中存在一个SQLHelper的辅助类,其中重载了几个方法,用来向数据库发出不同类型的命令
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/dot.gif)
它提供的全是静态类.这个项目的其他类通过这个辅助类进行对数据库数据的操作,相关的几个类全实现了IDAL接口
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
Model项目为业务实体,如用户实体
1
using System;
2![](/Images/OutliningIndicators/None.gif)
3
namespace PetShop.Model {
4![](/Images/OutliningIndicators/InBlock.gif)
5
/// <summary>
6
/// Business entity used to model accounts
7
/// </summary>
8
[Serializable]
9
public class AccountInfo {
10![](/Images/OutliningIndicators/InBlock.gif)
11
// 声明成员变量
12
private string _userId;
13
private string _password;
14
private string _email;
15
private AddressInfo _address;
16
private string _language;
17
private string _category;
18
private bool _showFavorites;
19
private bool _showBanners;
20![](/Images/OutliningIndicators/InBlock.gif)
21
/// <summary>
22
/// Default constructor
23
/// </summary>
24
public AccountInfo() {
25
}
26![](/Images/OutliningIndicators/InBlock.gif)
27
/// <summary>
28
/// Constructor with specified initial values
29
/// </summary>
30
/// <param name="userId">userId</param>
31
/// <param name="password">密码</param>
32
/// <param name="email">Email</param>
33
/// <param name="address">地址</param>
34
/// <param name="language">语言</param>
35
/// <param name="category">关注类型</param>
36
/// <param name="showFavorites">是否显示我关注的其他信息</param>
37
/// <param name="showBanners">是否显示我所关注的信息</param>
38
public AccountInfo(string userId, string password, string email, AddressInfo address, string language, string category, bool showFavorites, bool showBanners) {
39
this._userId = userId;
40
this._password = password;
41
this._email = email;
42
this._address = address;
43
this._language = language;
44
this._category = category;
45
this._showFavorites = showFavorites;
46
this._showBanners = showBanners;
47
}
48![](/Images/OutliningIndicators/InBlock.gif)
49
// Properties
50
public string UserId {
51
get { return _userId; }
52
}
53
public string Password {
54
get { return _password; }
55
}
56
public string Email {
57
get { return _email; }
58
}
59
public AddressInfo Address {
60
get { return _address; }
61
}
62
public string Language {
63
get { return _language; }
64
}
65
public string Category {
66
get { return _category; }
67
}
68
public bool IsShowFavorites {
69
get { return _showFavorites; }
70
}
71
public bool IsShowBanners {
72
get { return _showBanners; }
73
}
74
}
75
}
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
4
![](/Images/OutliningIndicators/InBlock.gif)
5
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
6
![](/Images/OutliningIndicators/InBlock.gif)
7
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
8
![](/Images/OutliningIndicators/InBlock.gif)
9
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
10
![](/Images/OutliningIndicators/InBlock.gif)
11
![](/Images/OutliningIndicators/InBlock.gif)
12
![](/Images/OutliningIndicators/InBlock.gif)
13
![](/Images/OutliningIndicators/InBlock.gif)
14
![](/Images/OutliningIndicators/InBlock.gif)
15
![](/Images/OutliningIndicators/InBlock.gif)
16
![](/Images/OutliningIndicators/InBlock.gif)
17
![](/Images/OutliningIndicators/InBlock.gif)
18
![](/Images/OutliningIndicators/InBlock.gif)
19
![](/Images/OutliningIndicators/InBlock.gif)
20
![](/Images/OutliningIndicators/InBlock.gif)
21
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
22
![](/Images/OutliningIndicators/InBlock.gif)
23
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
24
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
25
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
26
![](/Images/OutliningIndicators/InBlock.gif)
27
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
28
![](/Images/OutliningIndicators/InBlock.gif)
29
![](/Images/OutliningIndicators/InBlock.gif)
30
![](/Images/OutliningIndicators/InBlock.gif)
31
![](/Images/OutliningIndicators/InBlock.gif)
32
![](/Images/OutliningIndicators/InBlock.gif)
33
![](/Images/OutliningIndicators/InBlock.gif)
34
![](/Images/OutliningIndicators/InBlock.gif)
35
![](/Images/OutliningIndicators/InBlock.gif)
36
![](/Images/OutliningIndicators/InBlock.gif)
37
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
38
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
39
![](/Images/OutliningIndicators/InBlock.gif)
40
![](/Images/OutliningIndicators/InBlock.gif)
41
![](/Images/OutliningIndicators/InBlock.gif)
42
![](/Images/OutliningIndicators/InBlock.gif)
43
![](/Images/OutliningIndicators/InBlock.gif)
44
![](/Images/OutliningIndicators/InBlock.gif)
45
![](/Images/OutliningIndicators/InBlock.gif)
46
![](/Images/OutliningIndicators/InBlock.gif)
47
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
48
![](/Images/OutliningIndicators/InBlock.gif)
49
![](/Images/OutliningIndicators/InBlock.gif)
50
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
51
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
52
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
53
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
54
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
55
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
56
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
57
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
58
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
59
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
60
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
61
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
62
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
63
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
64
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
65
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
66
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
67
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
68
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
69
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
70
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
71
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
72
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
73
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
74
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
75
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
BLL这个项目就开始调用对数据库表操作的方法了.其中每个类都通过DALFactory项目载入需要的程序集,然后执行相关业务操作
这个是基本思想