0

I haven't worked much with transaction scoping and I want to make sure that I'm approaching this idea correctly before I jump in too deeply.

The Setup / Goal

  • I have a list of items that are files to be copied to a remote system.
  • For each file in that list, I need to create a transaction to:
    • Copy the file to a remote system
    • Make a call to a web service to add a reference to that new file to a database.
  • If either the web service call or the file copy fail, I need to roll both actions back.
    • Rolling back the file copy will mean deleting the file on the remote system.
    • Rolling back the web service action will mean calling a different web service method to delete the entry I just made.
  • If any of the items in the list of items fail, I'd like to return a message of some kind, but not stop the other items from being committed.

What I'm Considering Doing

In my (quite limited) reading on the topic, I think this might be the proper approach:

  • Create a Resource Manager for file copies that allows it to participate in durable transactions
  • Create a Resource Manager for the web service call along the same lines
  • Create a foreach loop for each item in the list
  • For each item, create a transaction scope that uses the two resource managers and rolls back / reports if something goes wrong.

The Question(s)

  • Is there anything I'm not seeing here or a new methodology I should be implementing, or is this actually the way to go?

Resources So Far

As I examine the problem and try to wrap my head around it, these are some of the pages I'm perusing:

Thanks in advance for any help you can give!

SeanKilleen
  • 8,809
  • 17
  • 80
  • 133
  • How about flowing the transaction to the web service instead of creating the web service as a resource? This will be possible only when the service is a WCF service and implementing a proper binding which supports transactions flow. Not very sure if this will be a viable solution for you though. – samar Aug 22 '13 at 12:10
  • Hi samar, that's a great idea and normally something I'd pursue, but in the context of my current project (and schedule) it unfortunately isn't an option. – SeanKilleen Aug 22 '13 at 15:43

0 Answers0