开发者

NHIbernate Load via QBE with single column PK

开发者 https://www.devze.com 2023-01-13 13:14 出处:网络
When invoking Session.Load where the class in question contains a composite id, Load expectes the provided criteria to be an example of the object in question with all the PK properties filled in. The

When invoking Session.Load where the class in question contains a composite id, Load expectes the provided criteria to be an example of the object in question with all the PK properties filled in. The problem is that I want to create a generic IRepository interface with a single Load method, always providing a QBE. How开发者_JAVA技巧ever, it seems that Load can not handle QBE if the PK is only a single property. Any thoughts?


Have a look at the repository interfaces in the S#arp Architecture project. They expose two interfaces that allow for a standard integer id as well as another other type (eg. your composite key object) to be specified for Get and Load operations. This is probably the route I would take in your case.

0

精彩评论

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