Pregunta

This must be something very simple, I just don't see it (and can not find the answer :(

I am trying to learn DevExpress controls and have read that eXpress Persistent Objects is recommended for O/R mapping.

1) I have an existing SQL Server Compact 4.0 database for which I generated ORM

2) I have a Winform with XtraGrid.GridControl gridControl1

3) In Form_Load event I have this code:

        XPCollection cName = new XPCollection(typeof(WindowsFormsApplication1.DUzskv1r6.XPO_TableName));

        int c = cName.Count; //didn't help...

        cName.DisplayableProperties = "Name;Nr"; //choose columns to display
        gridControl1.MainView.PopulateColumns();

        gridControl1.DataSource = cName;

I have read that it using "delayed loading" - loading when it is necessary (http://documentation.devexpress.com/#XPO/clsDevExpressXpoXPCollectiontopic), but reading XPcollections record Count didn't do the trick as it was suggested.

As a result I get an empty gridControl1 with columns "Name" and "Nr". Please help - what am I missing?

¿Fue útil?

Solución

I think the issue is somewhere in your datalayer initialization. You use XPCollection with default session, maybe you forgot to initialize it. The best way is to specify the session is in the XPCollection contractor.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top