初步学习petshop
2006-04-21 23:37 Clingingboy 阅读(853) 评论(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的辅助类,其中重载了几个方法,用来向数据库发出不同类型的命令













它提供的全是静态类.这个项目的其他类通过这个辅助类进行对数据库数据的操作,相关的几个类全实现了IDAL接口

Model项目为业务实体,如用户实体
1
using System;
2
3
namespace PetShop.Model {
4
5
/// <summary>
6
/// Business entity used to model accounts
7
/// </summary>
8
[Serializable]
9
public class AccountInfo {
10
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
21
/// <summary>
22
/// Default constructor
23
/// </summary>
24
public AccountInfo() {
25
}
26
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
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
}

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

BLL这个项目就开始调用对数据库表操作的方法了.其中每个类都通过DALFactory项目载入需要的程序集,然后执行相关业务操作
这个是基本思想
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现