请问如何写实体类?请大家给点理论知识。

damomo 2003-08-19 09:51:28
我现在参考Duwamish7写的好些概念很模糊,
如:业务层的对象就必须是数据库一条记录?
...全文
81 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
janus1999 2003-08-19
  • 打赏
  • 举报
回复
我现在正在做同样的工作!
brightheroes 2003-08-19
  • 打赏
  • 举报
回复
这样做很容易处理的
一条记录就是一个data类的实例
data提供删除,更新,新增等方法
qiujoe 2003-08-19
  • 打赏
  • 举报
回复
关于O-R映射的有一些模式可以用,
摘自Connecting Business Objects to Relational Databases

Persistence Layer
Provide a layer for mapping your objects to the RDBMS or other database.

CRUD
All persistent object need, at a minimum, create, read, update, and delete
operations.

SQL Code Description
Defines the actual SQL code that takes the values from the RDBMS or other
database and retrieves them for the object’s use and vice-versa. It is used to
generate the SQL for performing the CRUD operations.

Attribute Mapping Methods
Maps the values between the database values and attributes. This pattern also
handles complex object mappings. Populates the object(s) with the row values.
Type Conversion Works with Attribute Mapping Methods to translates values from the database to
the appropriate object types and vice-versa. Insures data integrity.

Change Manager
Keeps track of when an object’s values have been changed for maintaining
consistency with the database. It determines the need to write the values to a
database table or not.

OID Manager
Generates Unique Keys for the Object Ids during an insert.
Transaction Manager Provides a mechanism to handle transactions while saving objects.

Connection Manager
Gets and maintains a connection to the database.

Table Manager
Manages the mappings from an object to its database table(s) and column(s).
damomo 2003-08-19
  • 打赏
  • 举报
回复
请问DataAcess必须用存储过程?
damomo 2003-08-19
  • 打赏
  • 举报
回复
http://dotnet.owns.it/上不了啊?
chagel 2003-08-19
  • 打赏
  • 举报
回复
http://dotnet.owns.it/
^_^
wljcan 2003-08-19
  • 打赏
  • 举报
回复
这个不是书写规范的问题,应该是实体类如何组织的问题.是使用 DataSet、强类型的DataSet、Reader还是自定义的实体类? 这一点,你可以参考《NET 数据访问架构指南》。

就我个人的观点, .net并没有象J2EE那样,提供一套完整方便的多层体系结构的解决方案。Duwamish虽然结构比较好,但是扩展性和实用性都不是很高,比如对数据库中表的修改将会影响到数据层和数据访问层 (DAO),另外,如果数据库中表比较多的时候,代码量将会很大,给维护带来不便。

目前,很多公司都在做O-R map工具,如persistence .net,Objectspace等,国内也有人开始做了,你查一下相关文档,江苏的孙亚民发了好几篇文章,你可以看看
damomo 2003-08-19
  • 打赏
  • 举报
回复
那谁有实体类的书写规范?

110,532

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧