开发者

NHibernate: get all data from all DB tables

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
}


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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜