mdsrlz wrote:
Is there anybody here using NHibernate with Collections bounded to the Interface controls?
Check out
http://forum.hibernate.org/viewtopic.php?t=961346mdsrlz wrote:
How do you use NH with Win Forms Apps?
I have created an generic wrapper that implements most of the methods provided by ISession, and made this wrapper implement IComponent. For each entity I create a class inherited from the wrapper, and voila, I have strongly typed DAOs that easily can be used directly in a WinForm, and can be added using the designer.
For example:
Code:
public class GenericDao<T> : IComponent
{
public virtual T Load(int id)
{
return (T)session.Load(typeof(T), id);
}
...
}
public class CustomerDao : GenericDao<Customer>
{
}
And then:
Code:
Customer c = customerDao1.Load(123);
Each method in GenericDao<T> can be overridden, so if you want to add some business logic, you can easily add it for each entity.
I have also added some plumbing behind the scenes so a session can be shared across several DAOs, but the default feature is that each DAO gets its own session from the session factory.[/code]