Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
38 lines (32 loc) · 1.32 KB

File metadata and controls

38 lines (32 loc) · 1.32 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
// Loop through structured data sources
foreach (var ds in Model.DataSources.Where(a => a.Type.ToString() == "Structured").ToList())
{
string strdsName = ds.Name;
var strDataSource = (Model.DataSources[strdsName] as StructuredDataSource);
string serverName = strDataSource.Server;
string dbName = strDataSource.Database;
string userName = strDataSource.Username;
// Create provider data source
string provdsName = strdsName + "1";
var provDataSource = Model.AddDataSource(provdsName);
string conn = "Data Source="+serverName+";Initial Catalog="+dbName+";Persist Security Info=True";
if (userName != null)
{
conn = conn + ";User ID="+userName;
}
// Update provider data source connection string and provider
provDataSource.ConnectionString = conn;
provDataSource.Provider = "System.Data.SqlClient";
// Update partitions to use the new provider data source
foreach (var t in Model.Tables.ToList())
{
foreach (var p in t.Partitions.Where(a => a.DataSource.Name == strdsName).ToList())
{
p.DataSource = provDataSource;
}
}
// Delete structured data source
strDataSource.Delete();
// Rename provider data source
Model.DataSources[provdsName].Name = strdsName;
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.