PersistenceSpecification returns "no persister found for" when persisting a List of Enums.
Using FluentNhibernate v1.1.0.685, I have an object which is automapped using the default conventions, with the following as the sole override:
mapping.HasMany(c => c.Days).Element("DayOfWeek");
In my unit test, I have:
new PersistenceSpecification<Entity>(session)
.CheckProperty(c => c.Id, 1)
.CheckProperty(c => c.Name, "My Name")
.CheckList(c => c.Days, daysAvailable)
.VerifyTheMappings();
The domain object uses properties int Id, String Name, and IList<System.DayOfWeek> for Days. (I've also tried using a concrete implementation List<System.DayOfWeek> just out of morbid curiosity, but with no difference in result). When I run the test, Tests.VerifyMappings.CanMapEntity threw exception:
NHibernate.MappingException: No persister for: System.DayOfWeek
Another test that uses System.DayOfWeek as an ordinary property works just fine.
If, instead of using the PersistenceSpecification, I save the object using Session.Save and then reload it with Session.Retrieve, the expected count of items comes back and there is no mapping error. Is there something special about PersistenceSpecification that might cause this test to fail, or do I have false confidence in my object successfully being saved and retrieved?
Support Staff 2 Posted by James Gregory on 05 Nov, 2010 01:46 PM
The
PersistenceSpecification
isn't great at dealing with dictionary associations. We're looking to rectify this in a future release. Until then, it's likely it's us not you :)3 Posted by Gutek on 10 Feb, 2011 11:18 AM
@James
will this be fixed soon? I have similar issue now with 1.2.0.694 version of FN