public static DialogResult ShowWizard(Model model, ProviderDataSource source) { var dialog = new ImportTablesWizard(); //dialog.page1.Init(model); dialog.btnBack.Visible = false; dialog.btnNext.Visible = false; dialog.btnCancel.Left = 654; dialog.page2.RowLimitClause = source.GetRowLimitClause(); dialog.page2.IdentifierQuoting = source.GetIdentifierQuoting(); var tds = TypedDataSource.GetFromTabularDs(source); if (!dialog.page2.Init(tds)) { return(DialogResult.Cancel); } dialog.CurrentPage = 2; var res = dialog.ShowDialog(); if (res == DialogResult.OK) { DoImport(dialog.page1.Mode, model, dialog.page2.Source, dialog.page2.SelectedSchemas, dialog.page2.RowLimitClause, dialog.page2.IdentifierQuoting); } return(res); }
public static ProviderDataSource DeserializeProviderDataSource(JObject json, Model model) { var tom = TOM.JsonSerializer.DeserializeObject <TOM.ProviderDataSource>(json.ToString()); tom.Name = model.DataSources.GetNewName(tom.Name); var dataSource = ProviderDataSource.CreateFromMetadata(model, tom); return(dataSource); }
public static void CreateWingtipSalesModel(Database database) { Model model = database.Model; var dsProvider = new ProviderDataSource() { Name = "Azure SQL Server Data Source - PBI Dev Camp", Description = "A data source definition ", ConnectionString = "Provider=SQLNCLI11;Data Source=devcamp.database.windows.net;Initial Catalog=WingtipSalesDB;Integrated Security=False", ImpersonationMode = Microsoft.AnalysisServices.Tabular.ImpersonationMode.ImpersonateServiceAccount, Account = "CptAdmin" }; model.DataSources.Add(dsProvider); Table tableCustomers = CreateCustomersTable(); Table tableProducts = CreateProductsTable(); Table tableSales = CreateSalesTable(); Table tableCalendar = CreateCalendarTable(); model.Tables.Add(tableCustomers); model.Tables.Add(tableProducts); model.Tables.Add(tableSales); model.Tables.Add(tableCalendar); model.Relationships.Add(new SingleColumnRelationship { Name = "Customers to Sales", ToColumn = tableCustomers.Columns["CustomerId"], ToCardinality = RelationshipEndCardinality.One, FromColumn = tableSales.Columns["CustomerId"], FromCardinality = RelationshipEndCardinality.Many }); model.Relationships.Add(new SingleColumnRelationship { Name = "Products to Sales", ToColumn = tableProducts.Columns["ProductId"], ToCardinality = RelationshipEndCardinality.One, FromColumn = tableSales.Columns["ProductId"], FromCardinality = RelationshipEndCardinality.Many }); model.Relationships.Add(new SingleColumnRelationship { Name = "Calendar to Sales", ToColumn = tableCalendar.Columns["DateKey"], ToCardinality = RelationshipEndCardinality.One, FromColumn = tableSales.Columns["DateKey"], FromCardinality = RelationshipEndCardinality.Many }); model.SaveChanges(); model.RequestRefresh(RefreshType.Full); model.SaveChanges(); }
public static List <MetadataChange> GetChanges(ProviderDataSource dataSource) { var result = new List <MetadataChange>(); var tds = TypedDataSource.GetFromTabularDs(dataSource); foreach (var table in dataSource.Model.Tables.Where(t => t.Partitions[0].DataSource == dataSource)) { result.AddRange(GetChanges(table)); } return(result); }
public static DialogResult ShowWizard(Model model, ProviderDataSource source) { var dialog = new ImportTablesWizard(); dialog.page1.Init(model); var tds = TypedDataSource.GetFromTabularDs(source); if (!(tds is SqlDataSource) && int.TryParse(source.GetAnnotation("TabularEditor_RowLimitClause"), out int rlc)) { dialog.page2.RowLimitClause = (RowLimitClause)rlc; } dialog.page2.Init(tds); dialog.CurrentPage = 2; var res = dialog.ShowDialog(); if (res == DialogResult.OK) { DoImport(dialog.page1.Mode, model, dialog.page2.Source, dialog.page2.SelectedSchemas, dialog.page2.RowLimitClause); } return(res); }
public static void SchemaCheck(ProviderDataSource source) { var changes = TableMetadata.GetChanges(source); ReportSchemaCheckChanges(changes, source.Model); }
public IEnumerable <Provider> Get() { return(ProviderDataSource.GetProviders()); }
protected void Page_LoadComplete(object sender, EventArgs e) { ProviderDataSource.DataBind(); }