After the first fetch, close the session, this should cause all other objects to be detached, since you do not want any update this should be fine.
Code:
private void button1_Click(object sender, EventArgs e)
{
Customer c = new Customer();
using (ISession session = factory.OpenSession())
{
using (ITransaction tx = session.BeginTransaction())
{
c.Name = txtName.Text;
object obj = session.Save(c);
tx.Commit();
MessageBox.Show(c.ID.ToString());
FillGrid();
}
}
}
An other approach would be to mark those properties as immutable so they can be filled only once and not be updated.
Code:
<property
name="propertyName"
column="column_name"
type="typename"
update="true|false"
insert="true|false"
formula="arbitrary SQL expression"
access="field|property|ClassName"
/>
set update to false