Reputation: 3285
How can I iterate throw mapped entities and get all data from database? I dont know on first place what is mapped by NHibernate...
Configuration configuration = SessionProvider.Configuration;
var mappedClasses = configuration.ClassMappings;
IRepository repository = new Repository();
foreach (var mappedClass in mappedClasses)
{
var enumerable = repository.GetAll<mappedClass>();//<-- this dont work
}
Upvotes: 2
Views: 5169
Reputation: 29632
If you query on Object
, it queries all mapped classes in the session, so the following returns a list of all records in your database:
var completeList = session.CreateCriteria<Object>().List();
Upvotes: 9