Hi,
I'm new to NHibernate.
How can I use BindingList(Of T) instead of IList(Of T) in my application?
When I have my property declared as IList(Of T) everything works fine, but when I use BindingList(Of T) I get this error: {"Invalid mapping information specified for type Ghost.clsFournisseur, check your mapping file for property type mismatches"}
with Innerexception:
{"Unable to cast object of type 'NHibernate.Collection.Generic.PersistentGenericBag`1[Ghost.clsPersonne]' to type 'System.ComponentModel.BindingList`1[Ghost.clsPersonne]'."}
Thanks a lot in advance,
Pieter
Hibernate version:1.2.0.3001
Full stack trace of any exception that occurs: NHibernate.MappingException was unhandled Message="Invalid mapping information specified for type Ghost.clsFournisseur, check your mapping file for property type mismatches" Source="NHibernate" StackTrace: at NHibernate.Persister.Entity.AbstractEntityPersister.SetPropertyValues(Object obj, Object[] values) at NHibernate.Impl.SessionImpl.InitializeEntity(Object obj) at NHibernate.Loader.Loader.InitializeEntitiesAndCollections(IList hydratedObjects, Object resultSetId, ISessionImplementor session) at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies) at NHibernate.Loader.Loader.LoadEntity(ISessionImplementor session, Object id, IType identifierType, Object optionalObject, Type optionalEntityName, Object optionalIdentifier, IEntityPersister persister) at NHibernate.Loader.Entity.AbstractEntityLoader.Load(ISessionImplementor session, Object id, Object optionalObject, Object optionalId) at NHibernate.Loader.Entity.AbstractEntityLoader.Load(Object id, Object optionalObject, ISessionImplementor session) at NHibernate.Persister.Entity.AbstractEntityPersister.Load(Object id, Object optionalObject, LockMode lockMode, ISessionImplementor session) at NHibernate.Impl.SessionImpl.DoLoad(Type theClass, Object id, Object optionalObject, LockMode lockMode, Boolean checkDeleted) at NHibernate.Impl.SessionImpl.DoLoadByClass(Type clazz, Object id, Boolean checkDeleted, Boolean allowProxyCreation) at NHibernate.Impl.SessionImpl.Load(Type clazz, Object id) at Ghost.facFournisseur.SelectOneByID(Int32 FournisseurID) in F:\NET Projecten\Ghost 2.0\Sodimex\Factory\facFournisseur.vb:line 17 at Ghost.frmFournisseurs.FillEntrepriseField(Int32 EntrepriseID) in F:\NET Projecten\Ghost 2.0\Sodimex\GUI\frmFournisseurs.vb:line 37 at Ghost.frmEntreprises.dgvEntreprises_CellDoubleClick(Object sender, DataGridViewCellEventArgs e) in F:\NET Projecten\Ghost 2.0\Sodimex\GUI\frmEntreprises.vb:line 140 at System.Windows.Forms.DataGridView.OnCellDoubleClick(DataGridViewCellEventArgs e) at System.Windows.Forms.DataGridView.OnDoubleClick(EventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.DataGridView.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at Ghost.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
Name and version of the database you are using: SQL 2005 SP1
|