开发者

Object with Only Id

开发者 https://www.devze.com 2023-02-21 10:01 出处:网络
I want to get an object from my database but only populate it with the unique id identifier. I want all other fields to be null...any ideas on how to app开发者_如何学编程roach this????Using NHibernate

I want to get an object from my database but only populate it with the unique id identifier. I want all other fields to be null...any ideas on how to app开发者_如何学编程roach this????


Using NHibernate Linq provider:

Person obj = session.Query<Person>()
                    .Where(x => x.Id == id)
                    .Select(x => new Person() { Id = x.Id } )
                    .SingleOrDefault();
0

精彩评论

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

关注公众号