I am not very familiar with generics (concept or syntax) in general (I do not use them in collections, but what is not), but I was wondering if the following way is the best way to accomplish what I want. In fact, I'm not entirely sure that generics will solve my problem in this case.
I have modeled and matched several dozen objects in NHibernate and need some kind of universal class for my CRUD operations instead of creating a separate persister class for each type .. for example
Sub Update(someObject as Object, objectType as String) Dim session As ISession = NHibernateHelper.OpenSession Dim transaction As ITransaction = session.BeginTransaction session.Update(ctype(someObject, objectType)) transaction.Commit() End Sub
where someObject can be of different types. I know that this is not the best way to do this (or even if it will work), but I hope that someone will be able to direct me in the right direction.
source share