I really have no idea. But there are some problems with the approach you
have in that you never dispose of the session, so perhaps it's because the
connection is still open? WCF is really kinda hard to figure out why
something is or isn't happening. That said, we use WCF in our system, but
we don't use any of the transaction scope functionality and we have an
IOperationInvoker (or something like that) that we commit the transaction
after we invoke it.
On Tuesday, April 10, 2012 8:34:33 AM UTC-6, John T wrote:
>
> Hi all,
>
> We're trying to implement a WCF service using TransactionScope, and
> NHibernate to persist changes within the TransactionScope.
>
> I appreciate this could be/probably is a question better suited for WCF
> forums, but I figured other NH Users may have the answer.
>
> Our understanding is that you don't need to Flush() when using a
> Transaction(Scope) and the default FlushMode (Auto). Are we wrong?
>
> Simplified/Example Service:
>
> public class Service : IService
> {
> private ISession session;
>
> public Service()
> {
> // SessionBuilder configures, and builds an ISession, with default
> FlushMode.
> session = new SessionBuilder().GetSession();
> }
>
> [OperationBehavior(TransactionScopeRequired = true,
> TransactionAutoComplete = true)]
> public void Foo(string clientId)
> {
> session.Save(new Client { Id = clientId });
> }
> }
>
> The above never persists the new client. There are no obstructing foreign
> keys or similar :)
>
> Any help/advice appreciated.
>
> Regards,
> John.
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/QophW0EE24AJ.
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.