-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
44 lines (39 loc) · 1.56 KB
/
Copy pathProgram.cs
File metadata and controls
44 lines (39 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using Microsoft.SqlServer.Dac;
namespace DacFx.Nuget.Test
{
public class Program
{
public static void Main()
{
// Set the connection string
string connectionString = "";
DacServices service = new DacServices(connectionString);
service.Message += (sender, e) => {
Console.WriteLine(e.Message);
};
// Publish test, set dacpac path and target database
string publishSourceDacpac = "";
string publishTargetDatabase = "";
using (DacPackage dacpac = DacPackage.Load(publishSourceDacpac))
{
service.Publish(dacpac, publishTargetDatabase, new PublishOptions());
}
// Extract test, set dacpac path and source database
string extractSourceDatabase = "";
string extractTargetDacpac = "";
service.Extract(extractTargetDacpac, extractSourceDatabase, "testApp", new Version(1, 0));
// Import test, set bacpac path and target database
string importSourceBacpac = "";
string importTargetDatabase = "";
using (BacPackage bacpac = BacPackage.Load(importSourceBacpac))
{
service.ImportBacpac(bacpac, importTargetDatabase);
}
// Export test, set bacpac path and source database
string exportSourceDatabase = "";
string exportTargetBacpac = "";
service.ExportBacpac(exportTargetBacpac, exportSourceDatabase);
}
}
}