Work Around SQL Packager Retirement
muz
Posts: 6 New member
Hi there,
We bought a license to upgrade our SQL Data Compare from version 7 to version 13.
All of the code involved in the upgrade has been completed, except for updating RedGate.SQLPackager.Engine.dll. I saw the retirement note of this dll in your website, so we decided to stick to the existing dll as recommended.
Having followed your recommendation though, we have another dependency issue - see below for more details:
Existing code:
We bought a license to upgrade our SQL Data Compare from version 7 to version 13.
All of the code involved in the upgrade has been completed, except for updating RedGate.SQLPackager.Engine.dll. I saw the retirement note of this dll in your website, so we decided to stick to the existing dll as recommended.
Having followed your recommendation though, we have another dependency issue - see below for more details:
Existing code:
PackagerEngine engine = new PackagerEngine(
......,
.......,
.......,
m_SchemaBlock,//of type RedGate.Shared.SQL.ExecutionBlock.ExecutionBlock
m_DataBlock,//of type RedGate.Shared.SQL.ExecutionBlock.ExecutionBlock
.......,
.......);
Upgraded code:
.......);
Upgraded code:
PackagerEngine engine = new PackagerEngine(
......,
.......,
.......,
m_SchemaBlock,//of type RedGate.SQLCompare.Engine.IExecutionBlock
m_DataBlock,//of type RedGate.SQLCompare.Engine.IExecutionBlock
.......,
.......);
As you may have already guessed, the upgraded code fails as the constructor of 'PackagerEngine' expect a variable of type RedGate.Shared.SQL.ExecutionBlock.ExecutionBlock, whereas the new upgraded code changes this to the new reference, which is RedGate.SQLCompare.Engine.IExecutionBlock.
Please let me know what your recommendation is to workaround this issue.
Kind regards,
Muzafar Mahgoub
.......);
As you may have already guessed, the upgraded code fails as the constructor of 'PackagerEngine' expect a variable of type RedGate.Shared.SQL.ExecutionBlock.ExecutionBlock, whereas the new upgraded code changes this to the new reference, which is RedGate.SQLCompare.Engine.IExecutionBlock.
Please let me know what your recommendation is to workaround this issue.
Kind regards,
Muzafar Mahgoub
Tagged:
Answers
Regards, Muz
I believe you will need to explicitly cast the IExecutionBlock as an ExecutionBlock using one of the following:
or
Please give this a try and let me know if you are still running into an issue.
Kind regards,
Alex
Have you visited our Help Center?
You said: "I think Jess is right..."
I can't see any message from Jess or anyone, just the message you sent above. I hope I am not missing answers to my question somewhere in the site.
With regards to the suggestion above, this still doesn't work unfortunately as the property method (named ExecutionBlock) of the upgraded Work object (now provided by the assembly RedGate.SQLCompare.Engine.Deployment) returns an interface of type
RedGate.SQLCompare.Engine.IExecutionBlock, rather than RedGate.Shared.SQL.ExecutionBlock.ExecutionBlock (which is expected by the constructor of the old/retired PackagerEngine)
So when I come to cast the IExecutionBlock, I will be casting of type RedGate.SQLCompare.Engine.ExecutionBlock instead of RedGate.Shared.SQL.ExecutionBlock.ExecutionBlock, which brings the same issue - please see code sample below for clarity:
So now when I go:
.......);
I get the error:
"Argument type 'RedGate.SQLCompare.Engine.ExecutionBlock' is not assignable to parameter type 'RedGate.Shared.SQL.ExecutionBlock.ExecutionBlock' "
I hope this makes sense.
Please help!
Muz
Thanks, Muz
Apologies for that, it was a copy error from my internal notes that I forgot to remove when putting here - I have edited the post above.
I have asked the development team if there is a way around this with the latest version of the SDK, though it looks very much like this is going to require using an older version of the SDK.
I will update when I have further information.
Kind regards,
Alex
Have you visited our Help Center?
Yes this is one of the things I tried to do to follow your casting recommendation. I down-graded the assembly of the Work class to satisfy the type. But I found that the assembly I down-graded depends/links on another old assembly, so I down-graded that too, and this happened again. I ended up reverting back all of my original dlls (so reverted the application back to version 7).
Please let me know if there is a way around this issue.
Regards, Muz
Unfortunately there is not a way around this for using the dlls in this manner. One of the reasons (or perhaps outcomes) of retiring Packager is so that breaking changes could be made to the Comparison SDK. You will need to stick with the older versions to utilize this method.
I've also just realized that you are on Data Compare v13, which would be SQL Data Compare itself rather than the Comparison SDK (which was retired at v12) so you should not be using the dll's from version 13.
The official workaround is to use the command lines instead of the SDK - documentation and a download link for the script packaging utility command line can be found at https://documentation.red-gate.com/display/SQP8/SQL+Packager+8+documentation
I hope this helps clarify how things should work!
Kind regards,
Alex
Have you visited our Help Center?