// internal static to make it more testable internal static CommandProcessor PrepareCommandsAndIntegrityChecks( ModelBuilderSettings modelBuilderSettings, EditingContext editingContext, EntityDesignArtifact designArtifact) { Debug.Assert(modelBuilderSettings != null, "modelBuilderSettings != null"); Debug.Assert(editingContext != null, "editingContext != null"); Debug.Assert(designArtifact != null, "artifact != null"); var commands = new List <Command>(); if (modelBuilderSettings.NewFunctionSchemaProcedures != null && modelBuilderSettings.NewFunctionSchemaProcedures.Count > 0) { // user selected to create new FunctionImports, but don't create the composable ones as these have already been created by the runtime ModelBuilderEngine.ProcessStoredProcedureReturnTypeInformation( designArtifact, modelBuilderSettings.NewFunctionSchemaProcedures, commands, shouldCreateComposableFunctionImports: false); } else { commands.AddRange(CreateRemoveFunctionImportCommands(designArtifact)); } // for SqlServer and SqlServerCe we need to add integrity checks - see the comment below if (commands.Count > 0 || designArtifact.IsSqlFamilyProvider()) { // set up CommandProcessorContext var cpc = new CommandProcessorContext( editingContext, EfiTransactionOriginator.CreateNewModelId, Resources.Tx_CreateFunctionImport); // We propagate facets by default only for Sql Server or Sql Server CE since for other providers facets in C-Space might be intentionally // out of sync with facets from S-Space and we should not break this. For Sql Server and Sql Server CE facets should be in sync in most cases. if (designArtifact.IsSqlFamilyProvider()) { // Add integrity check to enforce synchronizing C-side Property facets to S-side values PropagateStoragePropertyFacetsToConceptualModel.AddRule(cpc, designArtifact); } return(new CommandProcessor(cpc, commands)); } // no commands or integrity checks to run return(null); }
private void UpdateNewFunctionFilterEntries() { var mapper = new TreeViewSchemaFilterMapper(); mapper.AddTreeView(AddTreeView.TreeViewControl, null); var filterEntryBag = mapper.CreateSchemaFilterEntryBag(); // because we only added the AddTreeView above IncludedSprocEntries is the list of selected // sprocs in the Add tab only var newFunctionEntries = filterEntryBag.IncludedSprocEntries.ToList(); // if there are any new Function entries and if the user has selected to create matching Function Imports // then create and run a ProgressDialog while we are collecting the sproc return type info if (newFunctionEntries.Count > 0 && chkCreateFunctionImports.Checked) { var result = ModelBuilderEngine.ShowProgressDialog(this, newFunctionEntries, Wizard.ModelBuilderSettings); } }
private void UpdateModelBuilderFilterSettings() { var mapper = new TreeViewSchemaFilterMapper(databaseObjectTreeView.TreeViewControl); var filterEntryBag = mapper.CreateSchemaFilterEntryBag(); IList <EntityStoreSchemaFilterEntry> newFunctionEntries = new List <EntityStoreSchemaFilterEntry>(); foreach (var entry in filterEntryBag.IncludedSprocEntries) { newFunctionEntries.Add(entry); } // if there are any new Function entries and if the user has selected to create matching Function Imports // then create and run a ProgressDialog while we are collecting the sproc return type info if (newFunctionEntries.Count > 0 && chkCreateFunctionImports.Checked) { var result = ModelBuilderEngine.ShowProgressDialog(this, newFunctionEntries, Wizard.ModelBuilderSettings); } }