Exemplo n.º 1
0
        public DataSchemaParameter(DataSchemaServer server, IVsDataParameter parameter)
            : base(server, parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException("parameter");
            }

            _parameter = parameter;
        }
Exemplo n.º 2
0
        public DataSchemaColumn(DataSchemaServer server, IVsDataColumn column)
            : base(server, column)
        {
            if (column == null)
            {
                throw new ArgumentNullException("column");
            }

            _column = column;
        }
        public DataSchemaParameter(DataSchemaServer server, IVsDataParameter parameter)
            : base(server, parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException("parameter");
            }

            _parameter = parameter;
        }
Exemplo n.º 4
0
        public DataSchemaColumn(DataSchemaServer server, IVsDataColumn column)
            : base(server, column)
        {
            if (column == null)
            {
                throw new ArgumentNullException("column");
            }

            _column = column;
        }
Exemplo n.º 5
0
        public DataSchemaObject(DataSchemaServer server, IVsDataMappedObject mappedObject)
        {
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }
            if (mappedObject == null)
            {
                throw new ArgumentNullException("mappedObject");
            }

            _server       = server;
            _mappedObject = mappedObject;
        }
Exemplo n.º 6
0
        public DataSchemaObject(DataSchemaServer server, IVsDataMappedObject mappedObject)
        {
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }
            if (mappedObject == null)
            {
                throw new ArgumentNullException("mappedObject");
            }

            _server = server;
            _mappedObject = mappedObject;
        }
 public DataSchemaProcedure(DataSchemaServer server, IVsDataExecutableObject executableObject)
     : base(server, executableObject)
 {
     _executableObject = executableObject;
 }
        // <summary>
        //     Processes the sproc return type information stored in newFunctionSchemaProceduresMap to
        //     add commands which create matching FunctionImports or delete Functions as necessary
        // </summary>
        // <param name="artifact"></param>
        // <param name="newFunctionSchemaProceduresMap">
        //     map of all processed EntityStoreSchemaFilterEntry for Functions to
        //     their IDataSchemaProcedure (where data was collected) or null (where data was not collected because the data
        //     collection process was interrupted)
        // </param>
        // <param name="commands">list of commands to which to add the create or delete commands</param>
        // <param name="shouldCreateComposableFunctionImports">whether to create FunctionImports for composable Functions</param>
        private static void PopulateNewFunctionSchemaProcedures(
            Dictionary<EntityStoreSchemaFilterEntry, IDataSchemaProcedure> newFunctionSchemaProcedureMap,
            string designTimeProviderInvariantName,
            string designTimeProviderConnectionString,
            DoWorkEventArgs e = null,
            BackgroundWorker worker = null,
            int startingAmountOfProgressBar = 0,
            int amountOfProgressBarGiven = 100)
        {
            // set up database connection
            var dataConnectionManager = Services.ServiceProvider.GetService(typeof(IVsDataConnectionManager)) as IVsDataConnectionManager;
            Debug.Assert(dataConnectionManager != null, "Could not find IVsDataConnectionManager");

            var dataProviderManager = Services.ServiceProvider.GetService(typeof(IVsDataProviderManager)) as IVsDataProviderManager;
            Debug.Assert(dataProviderManager != null, "Could not find IVsDataProviderManager");

            IVsDataConnection dataConnection = null;
            if (null != dataConnectionManager
                && null != dataProviderManager)
            {
                dataConnection = DataConnectionUtils.GetDataConnection(
                    dataConnectionManager, dataProviderManager, designTimeProviderInvariantName, designTimeProviderConnectionString);
            }
            if (null == dataConnection)
            {
                throw new ProgressDialogException(
                    string.Format(
                        CultureInfo.CurrentCulture, Design.Resources.RetrievingSprocReturnTypeErrorMessage, "null IVsDataConnection"));
            }

            // open the database connection and collect info for each Function
            try
            {
                dataConnection.Open();
                var dataSchemaServer = new DataSchemaServer(dataConnection);

                // now loop over all entries adding return type information
                var numFunctionFilterEntries = newFunctionSchemaProcedureMap.Count;
                var numFunctionFilterEntryCurrent = 0;
                foreach (var entry in newFunctionSchemaProcedureMap.Keys.ToList())
                {
                    numFunctionFilterEntryCurrent++;
                    if (worker != null
                        && e != null
                        && worker.CancellationPending)
                    {
                        // user requested interrupt of this process
                        e.Cancel = true;
                    }
                    else
                    {
                        if (worker != null
                            && worker.WorkerReportsProgress)
                        {
                            // report progress so ProgressDialog can update its status
                            var percentCompleted = startingAmountOfProgressBar +
                                                   ((int)
                                                       (((numFunctionFilterEntryCurrent - 1) / (float)numFunctionFilterEntries)
                                                        * amountOfProgressBarGiven));
                            var userState = new ProgressDialogUserState();
                            userState.NumberIterations = numFunctionFilterEntries;
                            userState.CurrentIteration = numFunctionFilterEntryCurrent;
                            userState.CurrentStatusMessage = string.Format(
                                CultureInfo.CurrentCulture,
                                Design.Resources.RetrievingSprocReturnTypeInfoMessage,
                                numFunctionFilterEntryCurrent,
                                numFunctionFilterEntries,
                                entry.Schema,
                                entry.Name);
                            worker.ReportProgress(percentCompleted, userState);
                        }

                        // now retrieve and store the return type information
                        var schemaProcedure = dataSchemaServer.GetProcedureOrFunction(entry.Schema, entry.Name);
                        Debug.Assert(
                            null == newFunctionSchemaProcedureMap[entry],
                            "This entry has already been processed, Schema = " + entry.Schema + ", Name = " + entry.Name);
                        newFunctionSchemaProcedureMap[entry] = schemaProcedure;
                    }
                }
            }
            finally
            {
                if (null != dataConnection)
                {
                    dataConnection.Close();
                }
            }
        }
Exemplo n.º 9
0
 public DataSchemaProcedure(DataSchemaServer server, IVsDataExecutableObject executableObject)
     : base(server, executableObject)
 {
     _executableObject = executableObject;
 }
 private void OnDoWork(object sender, DoWorkEventArgs e)
 {
     IDataSchemaProcedure storedProc = null;
     _openedDbConnection = Connection;
     if (_openedDbConnection != null)
     {
         var server = new DataSchemaServer(_openedDbConnection);
         var function = (Function)e.Argument;
         storedProc = server.GetProcedureOrFunction(function.DatabaseSchemaName, function.DatabaseFunctionName);
     }
     e.Result = storedProc;
 }