Example #1
0
        private void DoObjectFetch(object state)
        {
            SauceClassGenerationPackage.OutputWindow.OutputStringThreadSafe("Fetching Objects From database.." + Environment.NewLine);
            try
            {
                IDataBaseType item = null;

                this.InvokeOnMe(() =>
                {
                    this.IsEnabled     = false;
                    item               = ServerType.SelectedItem as IDataBaseType;
                    _currentConnection = item.ConnectionControl.GetConnection();
                    _currentConnection.SchemaValidator.CanAddColumns    = false;
                    _currentConnection.SchemaValidator.CanRemoveColumns = false;
                    _currentConnection.SchemaValidator.CanUpdateColumns = false;
                });

                if (item != null)
                {
                    _objects = new List <DBObjectWithType>();

                    try
                    {
                        _currentConnection.SchemaValidator.TableValidator.GetObjects(true).ToList().ForEach(r => _objects.Add(new DBObjectWithType(r, ObjectType.Table)));
                    }
                    catch (NotImplementedException)
                    {
                        SauceClassGenerationPackage.OutputWindow.OutputStringThreadSafe("Selected data store does not support fetching tables.." + Environment.NewLine);
                    }

                    try
                    {
                        _currentConnection.SchemaValidator.ViewValidator.GetObjects(true).ToList().ForEach(r => _objects.Add(new DBObjectWithType(r, ObjectType.View)));
                    }
                    catch (NotImplementedException)
                    {
                        SauceClassGenerationPackage.OutputWindow.OutputStringThreadSafe("Selected data store does not support fetching views.." + Environment.NewLine);
                    }

                    this.InvokeOnMe(() =>
                    {
                        Tables.ItemsSource = _objects;
                    });
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Unable to fetch database objects!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            finally
            {
                this.InvokeOnMe(() =>
                {
                    this.IsEnabled = true;
                });
            }
        }
Example #2
0
 public SauceHarness()
 {
     dstore = SqlServerConnection.GetDataStore("localhost", "sauce", "AppLogin", "AppLogin");
 }