NHIbernate Load via QBE with single column PK
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.
精彩评论