Radu & Cupcake, I found that you both have experience in using NHibernate with ObjectDataSource. I'm still working hard on that but not very successful. Could you please give us an example on using NHibernate with ObjectDataSource?
Up to now, I've experiement with it and got the following finding.
1. In ObjectDataSource, I need to specify the "DataObjectTypeName" in order to configure my Insert/Update/Delete method of the ObjectDataSource. Otherwise, I believe a list of parameters is needed. (I've not tried that.)
2. After completed step 1, I can use the design mode to edit the columns in GridView. I can also set the GridView to enable Edit/Delete in the design mode.
3. Here comes the problem. After I set the "DataObjectTypeName", my web page will raise an exception when trying to cast an ArrayList into a IList(Of objectName). The reason is my select function is expected to return a IList(Of objectName) while the List() function will return an IList. How can I solve this problem?
My own VB code making use of BaseDataAccess of
Benjamin's tutorial.
Code:
Public Function GetMaster() As IList(Of Master)
Dim mgr As New BaseDataAccess
Return mgr.Get(GetType(Master))
End Function
mgr.Get will call the following function finally.
Benjamin C# code (By the way, is this your so-called helper function?)
Code:
private IList GetByType(Type type)
{
IList items = null;
ITransaction tx = null;
try
{
tx = m_session.BeginTransaction();
items = m_session.CreateCriteria(type).List();
tx.Commit();
return items;
}
catch (Exception ex)
{
if (tx != null) tx.Rollback();
throw ex;
}
}
Sorry for off topic but I think Hpcd is also willing to see such example.