Is there an issue binding a result to a DataGridView with combo boxes with NHibernate?

As eti pointed out, this definitely is a lazy loading problem. When you fetch your products and lazy loading is turned on (the default), you'll get all your products but only the id of the brand. When you then show a list of your products in the datagridview, nhibernate is trying to load the name of the brand.

As you have closed the session object, it can't lazy load the brand entity, so you get an error back. I'd strongly suggest you take a look at ASP.Net MVC. It has a much cleaner model for working with ORMs (but yes, you lose all the fancy control binding).

If you can't or don't want to, you have three options.

I'm not sure if the answer below is directly tied to the Exception you are experiencing but I believe it will spare you a lot of trouble.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions