Yes, now we are talking about metrics applying to the model. At least some
of this is available from the existing Statistics module.

/Oskar


2012/9/11 TheCPUWizard <[email protected]>

> Oskar,****
>
> ** **
>
> But if one were to replace “rows affected” with “entities affected”, then
> I think the conversation gets much more interesting. For example I delete
> an Invoice entity, that is set to cascade delete the associated LineItem
> entities…How many entities (or even better which entities) were actually
> affected???….****
>
> ** **
>
> David****
>
> ** **
>
> *From:* [email protected] [mailto:[email protected]] *On
> Behalf Of *Oskar Berggren
> *Sent:* Tuesday, September 11, 2012 9:40 AM
> *To:* [email protected]
> *Subject:* Re: [nhusers] Affected rows in write methods****
>
> ** **
>
> As I'm sure you're aware, NHibernate is more than a database wrapper/API,
> unlike ADO.Net. It exposes a different model of your data which is centered
> around objects, not database tuples. Therefore the "amount of rows
> affected" is not only unavailable, it is not even relevant in an
> abstraction such as the Repository pattern.
>
> Like Gunnar said, Save() might insert 1 row. Or many rows in different
> tables depending on your mapping and cascading. Or it might insert 0 rows,
> and the INSERT statements might then get executed "together with" a
> subsequent query.
>
> If one wants to extract these figures for some sort of out-of-band
> statistical purposes, there's probably an extension point available
> somewhere, but putting it in a repository is only going to pollute the API
> IMHO.
>
> /Oskar
>
> ****
>
> 2012/9/11 Felipe Oriani <[email protected]>****
>
> No, I just want to implement this functionality on my repositories, but
> if it's not available, no problem. ****
>
> ** **
>
> But I think a little strange, because it works fine on ado.net with
> ExecuteNonQuery, of course the ado.net does not have a great design and
> transacional level as Nhibernate has but would be nice to have this feature
> on the ORM tool.****
>
> ** **
>
> On Tue, Sep 11, 2012 at 10:21 AM, Oskar Berggren <[email protected]>
> wrote:****
>
> Are you trying to accomplish anything in particular?
>
> /Oskar
>
> ****
>
> 2012/9/11 Felipe Oriani <[email protected]>****
>
> Hello guys, I would like to know, how can I get the affected rows when I
> call session's methods like Save, Delete, SaveOrUpdate, etc... as we got
> with ICommand.ExecuteNonQuery from Ado.Net? Is there any way to do this? I
> have a repository implementation and I would like to return this value,
> like this:****
>
> ** **
>
> public int Save(T entity)****
>
> {****
>
>     session.Save(entity);****
>
>     return ???;****
>
> }****
>
> ** **
>
> ** **
>
> Thank you!
> ****
>
> ** **
>
> -- ****
>
> ______________________________________
> Felipe B Oriani****
>
> felipeoriani.com.br [email protected]****
>
> "...Trabalhe quanto puder, tornando-se útil quanto possível..." , por
> André Luiz****
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.****
>
> ** **
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.****
>
>
>
> ****
>
> ** **
>
> -- ****
>
> ______________________________________
> Felipe B Oriani****
>
> felipeoriani.com.br [email protected]****
>
> "...Trabalhe quanto puder, tornando-se útil quanto possível..." , por
> André Luiz****
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.****
>
> ** **
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.****
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to