One of the drawbacks of having to create a manual rule for use in a Migration, is having to register the rule in Transform once it has been created in SQL Server. Here's a little trick I learned from ORT to easily automate a manual rule's registration. While this may not be a tremendous time-saver for one rule, if the project demands several manual rules, it could save some time down the line.
- Map as many fields as possible, including the field(s) requiring a manual rule. Initially, map a manual rule field with a Mapping Action of Default, and just put something simple as the default value. Don't worry, we'll change it in a later step.
- Submit the mappings and go through the AutoGen process as normal, creating your tables and rules. With a Default mapping action, dsp will not only create the default rule code, but also register it in Transform. Now you have a framework with which to use in order to create the actual manual rule.
- Open the mock default rule view (still intended for a manual rule) in SQL Server and adjust the view to include all the logic necessary for the more-complex manual rule. Save the view. Since the stored procedure from Transform is based on the view, the stored procedure does not need to be re-built.
- To ensure proper documentation in the project, go back to Map and reset the mock default mapping. Change the mapping action to Manual Rule with a good description in the Comments field. Re-submit the changed mapping. When the mapping is AutoGen'd again, more accurate documentation will be reflected for that field in the Rule Book.
Since the rule was already registered in Transform, it would not get deleted, even if all rules are created again in AutoGen.
Comments
3 comments