OK I admit it. During the development of SQL Data Compare 6 in order to get the product out on time we had to sacrifice doing the SQL Toolkit 6 help ( it didn’t involve chickens). So I thought I’d write a little bit to get you started on the v6 stuff as it seems to be coming up.
Those of you who’ve played with the latest version will appreciate how thoroughly cool comparing to a backup of a database is. So what we’ve done is given you that coolness in the latest version of the SQL Toolkit API. All you have to do is include a vast selection of dll references into your project and put a couple in the executable directory and you can make SQL Data Compare sit up and beg.
RedGate.BackupReader (Native backup files)
RedGate.BackupReader.SqbReader (Red Gate SQL Backup files only)
RedGate.Licensing.Client (has to be available for compile)
RedGate.SQLCompare.BackupReader (Backup SQL Compare engine)
RedGate.SQLDataCompare.Engine (Your friend and mine)
Dlls with the executable
rglz.dll (for compressed Red Gate SQL Backup files)
zlib1.dll (for compressed Red Gate SQL Backup files)
RedGate.BackupReader.CryptoHelper.dll (for encrypted Red Gate SQL Backup files)
I know it looks like a scary amount of files to include in your project but really you can experiment and if you’re not using Red Gate SQL Backup files you can ommit quite a few of the dependencies and is may still work – I’ve not really tested it.
So we add all those lovely new files to our project. Make sure when you add them that they all come from the SQL Data Compare 6 directory only. This is because the version of the SQL Compare engine that shipped with SQL Compare 6 isn’t the same as is shipped with SQL Data Compare.
The code is actually remarkably simple to write once you’ve got the references set up. It goes something like this…
Job done. You can see all of the overrides for BackupDatabase.RegisterForDataCompare() which allow you to specify files, passwords, backup sets and data sources.
The other main thing that we’ve added to the API is on the Project class. You’ve always been able to load a project via the API but not all the settings were applied, now however you have the lovely call you can make which is Project.ReplayUserActions(ref SchemaMappings). What this will do is set all the custom comparison keys, WHERE clauses and all the rest of the settings that make up the rest of the project not just which database you connect to. So you can set your project up using the UI and then run it via the API without issue.
Mainly the rest of the API remains unaffected and there is really no issue in migrating your projects from v5 to v6. Hope this has given you a taste of what is available now, go forth and code most fruitfully.