NHibernate保存详细信息性能

时间:2010-05-12 14:03:42

标签: nhibernate process

我是NHibernate的新手。当我正在做一些虚假的应用程序来学习时,我有一个疑问。 我请你就我的问题澄清一下。

我正在进行重置密码页面,我在其中获取用户详细信息并重置密码并保存回数据库。

1) Do I need to retrieve complete(whole row) details of the user.
2) If yes, I dont really need all the details of the user apart from his/her emailId to which I need to send an email.
3) If no, then how NHibernate knows that which details I changed while saving. How can I tell to NHibernate that you need to update only password column.

请澄清。

马赫什

1 个答案:

答案 0 :(得分:0)

在映射文件中,您可以指定“lazyload”的属性。这意味着它们不会在您第一次查询时被提取,但只有在实际上在运行时在代码中使用该属性时才会被提取。

通常这只针对指向其他表的属性,并不总是需要。检索一个表的整行不应该妨碍性能。您可以通过NHibernate检索对象,更改属性,并将其保存回数据库。你不应该担心其他任何事情。

关于NHibernate如何知道更新内容的问题:请查看FAQ

相关问题