NHibernate has no knowledge of your BindingList.

Also if I have list = session.SomeQueryMethod()...List(), I could very
well want to trim the list from loaded objects in memory, without
those being deleted from the database.

So you need to call Session.Delete() when deleting an object, unless
you are removing from a mapped collection, or you have called delete
on another object and, in your mappings, told the delete to cascade.

/Oskar



2011/8/24 Hans W <[email protected]>:
> Hello,
>
> I have a question to be sure of the need to call Session.Delete().
>
> The situation is as follows:
> 1. I have: private BindingList<Product> ProductList;
> 2. That list is filled with:
> ProductList = new BindingList<Product>(new
> ProductsQuery().GetQuery(Session).List<Product>());
> 3. ProductList is bound to a BindingSource.
>
> When I now want to delete a product I need to remove if from the
> bindingsource AS WELL call Session.Delete.
> I would have expected that the removal from the bindingsource would be
> enough for NHiberate to know that it should issue a delete statement
> to the database. Updates work ok in this situation.
>
> Can someone explain if I indeed need to call Session.Delete explicitly
> or that I am missing something?
> Thanks in advance,
> Hans
>
> --
> 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