Beetee Beetee - 8 months ago 47
C# Question

data don't appear in datagrid every time

I have a MDI application with 2 windows each containing a datagrid (implemented

). I get the data from a MSSQL database using nhibernate.

First window called "employee", containing name, street, birth date, ... :
class Employee

Second window called "work-time recording", containing hours, which project, name of employee, ... :
class WorkTimeRecording
(this class has a variable from type Employee)

When I open my application with just the "work-time recording" window, all data are shown correctly in the grid. When I open the application with both windows, the name of employee is missing in the work time recording datagrid.

Then I scroll in the employee datagrid to the appropriate person (and because of CellValueNeeded the data of this person is just loading in this moment). When I now switch back to work time recording datagrid, the name appears correctly.

But I want, that all data are shown directly, no matter which windows are open.

Any hints where I can start to search?

NHibernate mapping

<class name="WorkTimeRecording" table ="[WorkTime-Recording]" lazy="false">
<property name="IDEmployee" column="[ID-Employee]" />


The solution was, that my former colleague implemented the function with different levels of collecting data. The class WorkTimeRecording has different depths (basic, medium, complete - the reason is to get performance and just loading the data to the repository, which were needed) to fill the instance. When I switched to complete, the variable employee in WorkTimeRecording was filled correctly, no matter which other Windows were open.

So it's not a nhibernate issue as I thought, but loading enough data at the right time... and to understand the code, other people have written ;)