I've been scouring the web/SO for hours now so exuse me if I missed it...
I am looking for a concrete example of how to hook into the WCF pipeline when running as a WAS hosted in IIS so that a new LINQ to SQL DataContext is automatically created and disposed when the WCF request begins and ends.
Also, when the DataContext is being disposed would it be possible/ok to call SubmitChanges() at that point to commit any changes that have been made over the course of the request?
My main goals here are to:
One way to go about it would be to extend the OperationContext instance which gets created for each operation invoked in WCF. You can add extension to OperationContext. This extension can contain the DataContext instance which can be accessed and used at different location. Look at this post
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With