Hi Catalin,

That's one possibility, but it is not the desired approach.

Our scenario is as follows:

We have a Web (WCF) service that receives commands to perform actions on
various entities within the domain.

We would like to execute all of those commands in one Transaction. As we
are using WCF, we want to use TransactionScope, so we can take advantage of
TransactionFlow. We are led to believe that NHibernate integrates with
TransactionScope (a.k.a. Ambient Transaction).

The client application sends a List<> of Commands to the service. There
may, or may not be a "Create" command within this list. The other commands
will always be a "Modify" command that will modify data on an existing
entity.

So sometimes the commands will be a List containing one Create command,
followed by a number of Modify commands (all for the same entity). Other
times it will just be a list of Modify commands (to modify an existing
entity).

In summary, the client application is sending a Create command, with a list
of Modify commands to be executed immediately after the entity is created,
but if any of the modifications fail for any reason, then everything is
rolled back, including the initial Create.

Is that any clearer? :)

Regards,
John.

On Tue, Apr 10, 2012 at 4:08 PM, Catalin Placinta <
[email protected]> wrote:

> Hi John,
>
> I am not sure that I've understood your question; if you want to control
> yourself the instance when the flush is being done, you only have to modify
> the FlushMode property of your ISession object, when you create it:
>
> var session = sessionFactory.OpenSession();
> session.FlushMode = FlushMode.Never;
>
> If you set the FlushMode to Never, you will have to call it specifically
> when you want flush the session.
>
>
> On Tue, Apr 10, 2012 at 12:49 PM, John T <[email protected]>wrote:
>
>> Hi guys,
>>
>> I've hit a problem where we have a case that we are creating an
>> entity, saving it, then Query<T>()ing for it from cache and modifying
>> it. I.e. not flushing in between the initial Save() and Query().
>>
>> However, as I understand from a now quite old article[1] on Ayende's
>> blog that this is "not possible" unless we explicity use Get()/Load().
>>
>> Has the situation improved since then, or is the same restriction
>> still in place?
>>
>> Many thanks,
>> John.
>>
>> [1]
>> http://ayende.com/blog/3988/nhibernate-the-difference-between-get-load-and-querying-by-id
>>
>> --
>> 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