开发者

If I use nhibernate to map tables 1:1 with no associates, do I still need dynamic proxy etc?

If I just want to keep things very simple, and just map my tables to POCO 1:1 with no collections on the entities

e.g. instead of do开发者_高级运维ing :

class Order
class OrderItems

where you have:

Order o = new Order();
o.Items <-- collection of OrderItems that will query the db using lazy loading

I just have to do this manually:

Order o = myDAO.FindById(1);
OrderItems i = myDAO2.FindByOrderId(o.Id);

using this approach, do I still need to use castle.dynamic proxy dll and have to work around the medium trust issue?


If you are not using lazy loading you don't need proxy. Even when you download from nhforge, assemblies are split into required and required-for-lazy-loading.


No you don't need castle dynamic proxy, but you need some kind of proxy to use NHibernate. Nhibernate has build in support for castle and linfu, but it is not difficult to create your own proxyfactory for any kind of dynamic proxy like spring or unity.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜