Debugging Server Business Rules |
Visual Studio allows the connection to other processes through the debugger. This is very helpful in stepping through business rule code that is developed against ShipExec. The directions below are on how to connect using Visual Studio 2010 Professional Debugger.
With the business rules project open in Visual Studio. Select Debug -> Attach to Process… from the file menu. This will bring up the Attach to Process dialog window.
Find SoxOnWcfWinService.exe process. Highlight and click Attach. This will put Visual Studio in debug mode. When attaching to a process, it is easiest to find the correct WCF instance by stopping all other instances of ShipExec. The ToolTip also provides the location of the executable when you place the cursor over the process name.
To debug the Load business rule, place a breakpoint in the load method of the SBR.
public ShipmentRequest load(string value, ShipmentRequest shipmentRequest, ref SoxDictionary Params) { //Creating New Sox Shipment Request ShipmentRequest ship_req = new ShipmentRequest(); //Creating Default Attributes ship_req.def_attr = new Package(); //Creating Consignee ship_req.def_attr.consignee = new NameAddress(); ship_req.def_attr.consignee.company = "Consignee Company"; ship_req.def_attr.consignee.address1 = "123 East Ave"; ship_req.def_attr.consignee.city = "Orlando"; ship_req.def_attr.consignee.state_province = "FL"; ship_req.def_attr.consignee.postal_code = "32809"; ship_req.def_attr.consignee.country_symbol = "UNITED_STATES"; }
Now execute the ShipExec load method. The business rules will stop at your breakpoint enabling you to debug your business rules.
Debugging at this point can be done against any custom assemblies as you can enter them using the PSI.Sox.SBR.dll as an entry point.