开发者

Is there any ORM Framework which maps in another way than ActiveRecord pattern says?

开发者 https://www.devze.com 2023-02-17 05:36 出处:网络
There is commonly used method to map object to table (one object - one row in a table; the table is corresponding to object type), i.e., each object\'s public field is mapped to corresponding column i

There is commonly used method to map object to table (one object - one row in a table; the table is corresponding to object type), i.e., each object's public field is mapped to corresponding column in a table. Most of the ORM Frameworks are based on that mapping method. The question is there any ORM Framework (based on .Net Framework and well suited for C#) which allows to map object o开发者_运维知识库nto several rows in a table where each object's field is mapped to corresponding table's row?


I think what you're looking for is an ORM that generates Collection objects for each of your tables.

Look into Propel ORM

Any query that returns more than 1 row returns a TableObjectCollection object that has multiple convenient methods for access.


It is hard to say for all ORM Frameworks existing for today. But mapping in a following way:

(1) class type - table, (2) class member/field - column of the table, (3) class instance - row in a table,

is the well known practice. So, the more probable answer is there is no such ORM which maps a particular class instance on several rows. Otherwise, in accord with (2) the class type must has several members/fields represented with the same name but this is hardly possible.

0

精彩评论

暂无评论...
验证码 换一张
取 消