这样做很容易处理的
一条记录就是一个data类的实例
data提供删除,更新,新增等方法

解决方案 »

  1.   

    这个不是书写规范的问题,应该是实体类如何组织的问题.是使用 DataSet、强类型的DataSet、Reader还是自定义的实体类? 这一点,你可以参考《NET 数据访问架构指南》。就我个人的观点, .net并没有象J2EE那样,提供一套完整方便的多层体系结构的解决方案。Duwamish虽然结构比较好,但是扩展性和实用性都不是很高,比如对数据库中表的修改将会影响到数据层和数据访问层 (DAO),另外,如果数据库中表比较多的时候,代码量将会很大,给维护带来不便。目前,很多公司都在做O-R map工具,如persistence .net,Objectspace等,国内也有人开始做了,你查一下相关文档,江苏的孙亚民发了好几篇文章,你可以看看
      

  2.   

    请问DataAcess必须用存储过程?
      

  3.   

    关于O-R映射的有一些模式可以用,
    摘自Connecting Business Objects to Relational DatabasesPersistence 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).