"No persister for" error with NHibernate, NHibernate.Linq and Fluent Mapping -
I am using Nhibernate 2.1.2.4000 with GH Nhibernate.Linq 1.0 and download the latest version of FlintNhibernate from master on github I am doing. / P>
I am doing some testing and whenever I try to delete a unit retrieved by a Linux query, I get this error:
No firmness for it No: NHibernate.Linq.Query` 1 [[Employee. Core. NTTSEMP employee, employee. Core, version = 1.0.0.0, culture = neutral, public keynote = zero]]
All other operations (insert, update and select) looks fine;
My Entity class:
Public class employee {public employee () {} Public Virtual Ent 32 ID {receipt; Private set; } Public Virtual String Name {get; Set; } Public Virtual String Sahelo () {String.Format ("Hello World!", Said, "{0}.", Name); }}
Mapping Class:
Public Class Employee Map: Classplapp & lt; Employee & gt; {Public Employee Map () {ID (x => x.Id); Map (x = & x; x.Name). Not. (). Lang (50); }}
Configuration:
Assembly MappingSaSmith = Assembly. Gate AccedingAssemband (); Returns Fluley Configure () .desk (MsSqlConfiguration.MsSql2008 .ConnectionString (connectionString) .ProxyFactoryFactory (TypePixFactoryFactory) .ShowSql ()) Mapping (m => m.FluentMappings.AddFromAssembly (mappingsAssemly)) .BuildSessionFactory ();
And the code that does not work:
Public Zero RemoveAll () {var q = employee _session.Linq & lt; Employee & gt; () Select Employees; Foreign currency (q.ToList (var employees) {_session.Delete (q); }}
Any thoughts?
We all forgot it!
Sorry and thanks for all your help I just thought
If you pay attention to the RemoveAll () method then you will see that I want to delete the "q" object I'm trying to do that which is not a unit, but instead of passing "employee" an IQueriable. It was a lack of attention.
The correct code will be:
Public Zero RemoveAll () {var q = Select the _session.Linq () employee from the employee; Var p = q.ToList (); Foreign currency (senior employees in P) {_session.Delete (employee); }}
Comments
Post a Comment