Comments
3 comments
-
Hi,
Sorry that you're experiencing this problem. Which version of the SDK are you using? If you try it with the latest version of the SDK, does the problem still occur? Here's a download link if you need it - download link -
Sorry, I was doing some testing today and found that the problem is that I was disposing the database object prior to calling the method.
Thanks. -
No problem! I'm pleased that everything's working now.
Add comment
Please sign in to leave a comment.
public void GenerateScriptsToFolder(Differences differences, string file)
{
foreach (var diff in differences)
{
diff.Selected = (diff.Type != RedGate.Shared.ComparisonInterfaces.DifferenceType.Equal
&& diff.Type != RedGate.Shared.ComparisonInterfaces.DifferenceType.OnlyIn1
&& diff.DatabaseObjectType != ObjectType.Schema);
}
var work = new Work();
work.BuildFromDifferences(differences, Options.IncludeDependencies, true);
using (var stream = work.ExecutionBlock.GetStream())
{
using (var fileStream = File.Create(file))
{
stream.Seek(0, SeekOrigin.Begin);
stream.CopyTo(fileStream);
}
}
}
I am calling this function sending the differences (I can see them correctly when I create a datatable with the information), however, on the BuildFromDifferences, it is throwing a null reference exception without any more details.
Any idea why? is something wrong on this?
Best Regards.