What is the best way to load ALL of these data? How do I use the DataGridView when creating a form without a Delay in its opening?
Paging the DataGridView. This answer of the gringo OS has an example which I reproduce translated below:
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace ExemploPaginacao
{
public partial class Form1 : Form
{
private const int totalRegistros = 15000;
private const int tamanhoPagina = 50;
public Form1()
{
InitializeComponent();
dataGridView1.Columns.Add(new DataGridViewTextBoxColumn { DataPropertyName = "Index" });
bindingNavigator1.BindingSource = bindingSource1;
bindingSource1.CurrentChanged += new System.EventHandler(bindingSource1_CurrentChanged);
bindingSource1.DataSource = new ListaPaginada();
}
private void bindingSource1_CurrentChanged(object sender, EventArgs e)
{
// Este evento prepara um novo conjunto de registros quando o Current (propriedade que indica o registro atual da Grid é mudado
int deslocamento = (int)bindingSource1.Current;
var registros = new List<Registro>();
for (int i = deslocamento; i < deslocamento + tamanhoPagina && i < totalRegistros; i++)
registros.Add(new Registro { Index = i });
dataGridView1.DataSource = registros;
}
class Registro
{
public int Index { get; set; }
}
class ListaPaginada: System.ComponentModel.IListSource
{
public bool ContemColecaoDeListas { get; protected set; }
public System.Collections.IList GetList()
{
// Retorna uma lista de deslocamentos de página baseada em "totalRegistros" and "tamanhoPagina"
var deslocamentosPaginas = new List<int>();
for (int deslocamento = 0; deslocamento < totalRegistros; deslocamento += tamanhoPagina)
deslocamentosPaginas.Add(deslocamento);
return deslocamentosPaginas;
}
}
}
}
Has anyone ever used Nhibernate with Reactive?
Can you improve this part of the question? This part is based on opinions and does not fit a good answer, therefore.