Click here to Skip to main content
15,881,938 members

Comments by Kent K (Top 1 by date)

Kent K 18-Jul-11 14:17pm View    
Granted, my experience with WCF and transactions doesn't involve an EF model, but I wanted to provide notice on how your problem could be solved (again, I probably should have stated that it is a solution that isn't using EF model but for people finding your post for/by other means. .).
So, I have a system where I've built WCF services that run in IIS. I can pass custom objects of my choosing to them or retrieve objects from them like you would expect. My sytem is 3-tier. A desktop client is, well, the client. The WCF service (middle) uses SQL server for the backend. In the client I can wrap 7-8 different WCF service calls, some of which require an id from a foreign key field to be able to do an insert in a related table, in a transaction. With MSDTC configured in IIS and SQL server, a transaction will flow from client to service to db and all the way back to the client such that if there is a problem anywhere it simply rolls back and I don't have to do any messy "unwinding" of partial record inserts and what have you, myself.
That's the scenario I'm familiar with with behavior you questioned about. I'm not sure what level of control you have with EF models and their generated services, for transactions. Perhaps you'll have to make a service manually to do the task you are needing to be done instead of relying on the EF model to do it? Or hopefully there is a way to tell the EF model to make the service and a particular service method "transactional" in nature. The service and service methods do need to be marked with attributes to get it all to work.