コード例 #1
0
        public ModelingOptionsViewModel(
            IVisualStudioAccess visualStudioAccess,
            Func <IAdvancedModelingOptionsDialog> advancedModelingOptionsDialogFactory)
        {
            this.visualStudioAccess = visualStudioAccess;
            this.advancedModelingOptionsDialogFactory = advancedModelingOptionsDialogFactory;

            Title = string.Empty;
            MayIncludeConnectionString = true;

            OkCommand       = new RelayCommand(Ok_Executed);
            CancelCommand   = new RelayCommand(Cancel_Executed);
            AdvancedCommand = new RelayCommand(Advanced_Executed);

            Model = new ModelingOptionsModel();
            Model.PropertyChanged += Model_PropertyChanged;
            GenerationModeList     = new[]
            {
                ReverseEngineerLocale.EntityTypesAndContext,
                ReverseEngineerLocale.DbContextOnly,
                ReverseEngineerLocale.EntityTypesOnly,
            };
            HandlebarsLanguageList = new[]
            {
                "C#",
                "TypeScript",
            };
        }
コード例 #2
0
        public PickServerDatabaseViewModel(
            IVisualStudioAccess visualStudioAccess,
            ICredentialStore credentialStore,
            Func <IPickSchemasDialog> pickSchemasDialogFactory,
            Func <IPickConnectionDialog> pickConnectionDialogFactory)
        {
            this.visualStudioAccess          = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
            this.pickSchemasDialogFactory    = pickSchemasDialogFactory ?? throw new ArgumentNullException(nameof(pickSchemasDialogFactory));
            this.pickConnectionDialogFactory = pickConnectionDialogFactory ?? throw new ArgumentNullException(nameof(pickConnectionDialogFactory));
            this.credentialStore             = credentialStore ?? throw new ArgumentNullException(nameof(credentialStore));

            LoadedCommand = new RelayCommand(Loaded_Executed);
            AddDatabaseConnectionCommand      = new RelayCommand(AddDatabaseConnection_Executed);
            AddAdhocDatabaseConnectionCommand = new RelayCommand(AddAdhocDatabaseConnection_Executed);
            AddDatabaseDefinitionCommand      = new RelayCommand(AddDatabaseDefinition_Executed);
            RemoveDatabaseConnectionCommand   = new RelayCommand(RemoveDatabaseConnection_Executed, RemoveDatabaseConnection_CanExecute);
            OkCommand            = new RelayCommand(Ok_Executed, Ok_CanExecute);
            CancelCommand        = new RelayCommand(Cancel_Executed);
            FilterSchemasCommand = new RelayCommand(FilterSchemas_Executed, FilterSchemas_CanExecute);

            CodeGenerationModeList = new[]
            {
                "EF Core 5",
                "EF Core 3",
                "EF Core 6",
            };

            DatabaseConnections = new ObservableCollection <DatabaseConnectionModel>();
            DatabaseDefinitions = new ObservableCollection <DatabaseDefinitionModel>();
            Schemas             = new List <SchemaInfo>();
            DatabaseDefinitions.CollectionChanged += (sender, args) => RaisePropertyChanged(nameof(DatabaseDefinitions));
        }
コード例 #3
0
 public ToolWindowInitializer([NotNull] IVisualStudioAccess visualStudioAccess,
                              [NotNull] DependencyResolver dependencyResolver)
 {
     _visualStudioAccess = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
     _dependencyResolver = dependencyResolver ?? throw new ArgumentNullException(nameof(dependencyResolver));
     _visualStudioAccess.SolutionClosed += (sender, args) => _dependencyResolver.HandleSolutionClosed();
 }
コード例 #4
0
        public void Constructor_ArgumentNullException()
        {
            // Arrange
            IVisualStudioAccess vsa = null;

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => new PickServerDatabaseViewModel(vsa));
        }
コード例 #5
0
 public ScriptCreationService([NotNull] IWorkUnitFactory workUnitFactory,
                              [NotNull] IVisualStudioAccess visualStudioAccess,
                              [NotNull] ILogger logger)
     : base(logger)
 {
     _workUnitFactory    = workUnitFactory ?? throw new ArgumentNullException(nameof(workUnitFactory));
     _visualStudioAccess = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
 }
コード例 #6
0
 public DeleteRefactorLogUnit([NotNull] IFileSystemAccess fileSystemAccess,
                              [NotNull] IVisualStudioAccess visualStudioAccess,
                              [NotNull] ILogger logger)
 {
     _fileSystemAccess   = fileSystemAccess ?? throw new ArgumentNullException(nameof(fileSystemAccess));
     _visualStudioAccess = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
 }
コード例 #7
0
 public ConfigurationService(IFileSystemAccess fileSystemAccess,
                             IVisualStudioAccess visualStudioAccess,
                             ILogger logger)
 {
     _fileSystemAccess   = fileSystemAccess ?? throw new ArgumentNullException(nameof(fileSystemAccess));
     _visualStudioAccess = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
 }
コード例 #8
0
 public CommandAvailabilityService(IVisualStudioAccess visualStudioAccess,
                                   IScaffoldingService scaffoldingService,
                                   IScriptCreationService scriptCreationService)
 {
     _visualStudioAccess    = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
     _scaffoldingService    = scaffoldingService ?? throw new ArgumentNullException(nameof(scaffoldingService));
     _scriptCreationService = scriptCreationService ?? throw new ArgumentNullException(nameof(scriptCreationService));
 }
コード例 #9
0
 public InstalledComponentsService(IVisualStudioAccess visualStudioAccess,
                                   IFileSystemAccess fileSystemAccess,
                                   IDotNetAccess dotNetAccess)
 {
     _visualStudioAccess = visualStudioAccess;
     _fileSystemAccess   = fileSystemAccess;
     _dotNetAccess       = dotNetAccess;
 }
コード例 #10
0
 public InstalledComponentsService(IVisualStudioAccess visualStudioAccess,
                                   IFileSystemAccess fileSystemAccess,
                                   IDotNetAccess dotNetAccess)
 {
     _visualStudioAccess = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
     _fileSystemAccess   = fileSystemAccess ?? throw new ArgumentNullException(nameof(fileSystemAccess));
     _dotNetAccess       = dotNetAccess ?? throw new ArgumentNullException(nameof(dotNetAccess));
 }
コード例 #11
0
        public void Constructor_ArgumentNullException()
        {
            // Arrange
            IVisualStudioAccess vsa = null;
            var psdFactory          = Mock.Of <Func <IPickSchemasDialog> >();

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => new PickServerDatabaseViewModel(vsa, psdFactory));
        }
コード例 #12
0
        public CompareOptionsViewModel(IVisualStudioAccess visualStudioAccess)
        {
            this.visualStudioAccess = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));

            AddDatabaseConnectionCommand    = new RelayCommand(AddDatabaseConnection_Executed);
            RemoveDatabaseConnectionCommand = new RelayCommand(RemoveDatabaseConnection_Executed, RemoveDatabaseConnection_CanExecute);
            OkCommand     = new RelayCommand(Ok_Executed, Ok_CanExecute);
            CancelCommand = new RelayCommand(Cancel_Executed);
        }
コード例 #13
0
        public void Constructor_ArgumentNullException_VisualStudioAccess()
        {
            // Arrange
            IVisualStudioAccess vsa = null;
            IDotNetAccess       dna = null;

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => new InstalledComponentsService(vsa, dna));
        }
コード例 #14
0
        public MigrationOptionsViewModel(IVisualStudioAccess visualStudioAccess)
        {
            this.visualStudioAccess = visualStudioAccess;

#pragma warning disable VSTHRD101 // Avoid unsupported async delegates
            LoadedCommand = new RelayCommand(async() => await Loaded_ExecutedAsync());
            applyCommand  = new RelayCommand(async() => await Apply_ExecutedAsync(), () => !applying);
#pragma warning restore VSTHRD101 // Avoid unsupported async delegates
            CancelCommand = new RelayCommand(Cancel_Executed);
        }
コード例 #15
0
        public PickConfigViewModel(IVisualStudioAccess visualStudioAccess, Func <IPickSchemasDialog> pickSchemasDialogFactory)
        {
            LoadedCommand = new RelayCommand(Loaded_Executed);
            OkCommand     = new RelayCommand(Ok_Executed, Ok_CanExecute);
            CancelCommand = new RelayCommand(Cancel_Executed);

            Configurations = new ObservableCollection <ConfigModel>();

            Configurations.CollectionChanged += (sender, args) => RaisePropertyChanged(nameof(Configurations));
        }
コード例 #16
0
        public void Constructor_ArgumentNullException_VisualStudioAccess()
        {
            // Arrange
            var aem = new AboutExtensionModel();
            var evs = Mock.Of <IExtensionVersionService>();
            var ics = Mock.Of <IInstalledComponentsService>();
            var osa = Mock.Of <IOperatingSystemAccess>();
            IVisualStudioAccess vsa = null;
            IMessenger          m   = null;

            // Act & Assert
            Assert.Throws <ArgumentNullException>(() => new AboutViewModel(aem, evs, ics, osa, vsa, m));
        }
コード例 #17
0
        private IUnityContainer CreateContainer(IVisualStudioAccess visualStudioAccess,
                                                ILogger logger,
                                                OleMenuCommandService commandService)
        {
            return(new UnityContainer()

                   // Register self
                   .RegisterInstance(typeof(IDependencyResolver), this, new ContainerControlledLifetimeManager())

                   // Visual Studio dependencies
                   .RegisterInstance(commandService, new ContainerControlledLifetimeManager()) // The command service

                   // Tool window initialization
                   .RegisterSingleton <ToolWindowInitializer>()

                   // ViewModels
                   .RegisterType <ScriptCreationViewModel>()
                   .RegisterType <VersionHistoryViewModel>()
                   .RegisterType <ConfigurationViewModel>()

                   // Services with state / events
                   .RegisterSingleton <IConfigurationService, ConfigurationService>()
                   .RegisterSingleton <IScaffoldingService, ScaffoldingService>()
                   .RegisterSingleton <IScriptCreationService, ScriptCreationService>()

                   // Stateless services
                   .RegisterType <ICommandAvailabilityService, CommandAvailabilityService>()
                   .RegisterType <IBuildService, BuildService>()
                   .RegisterType <IVersionService, VersionService>()
                   .RegisterType <ISqlProjectService, SqlProjectService>()
                   .RegisterType <IXmlFormatService, XmlFormatService>()
                   .RegisterType <IArtifactsService, ArtifactsService>()
                   .RegisterType <IScriptModifierProviderService, ScriptModifierProviderService>()

                   // Data Access
                   .RegisterSingleton <IFileSystemAccess, FileSystemAccess>()
                   .RegisterInstance(visualStudioAccess, new ContainerControlledLifetimeManager())
                   .RegisterInstance(logger, new ContainerControlledLifetimeManager())
                   .RegisterType <IDacAccess, DacAccess>()

                   // Factories
                   .RegisterSingleton <IScriptModifierFactory, ScriptModifierFactory>()
                   .RegisterSingleton <IWorkUnitFactory, WorkUnitFactory>());
        }
コード例 #18
0
        internal DependencyResolver([NotNull] IVisualStudioAccess visualStudioAccess,
                                    [NotNull] ILogger logger,
                                    [NotNull] OleMenuCommandService commandService)
        {
            if (visualStudioAccess == null)
            {
                throw new ArgumentNullException(nameof(visualStudioAccess));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (commandService == null)
            {
                throw new ArgumentNullException(nameof(commandService));
            }

            _container = CreateContainer(visualStudioAccess,
                                         logger,
                                         commandService);
        }
コード例 #19
0
        internal DependencyResolver([NotNull] IVisualStudioAccess visualStudioAccess,
                                    [NotNull] ILogger logger,
                                    [NotNull] OleMenuCommandService commandService)
        {
            if (visualStudioAccess == null)
            {
                throw new ArgumentNullException(nameof(visualStudioAccess));
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (commandService == null)
            {
                throw new ArgumentNullException(nameof(commandService));
            }

            _container = CreateContainer(visualStudioAccess,
                                         logger,
                                         commandService);
            _viewModels = new Dictionary <Type, Dictionary <string, object> >();
        }
コード例 #20
0
 public ValidateTargetVersionUnit([NotNull] IVisualStudioAccess visualStudioAccess,
                                  [NotNull] ILogger logger)
 {
     _visualStudioAccess = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
     _logger             = logger ?? throw new ArgumentNullException(nameof(logger));
 }
コード例 #21
0
 public ToolWindowInitializer([NotNull] IVisualStudioAccess visualStudioAccess,
                              [NotNull] DependencyResolver dependencyResolver)
 {
     _visualStudioAccess = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
     _dependencyResolver = dependencyResolver ?? throw new ArgumentNullException(nameof(dependencyResolver));
 }
コード例 #22
0
 public ArtifactsService([NotNull] IVisualStudioAccess visualStudioAccess,
                         [NotNull] IFileSystemAccess fileSystemAccess)
 {
     _visualStudioAccess = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
     _fileSystemAccess   = fileSystemAccess ?? throw new ArgumentNullException(nameof(fileSystemAccess));
 }
コード例 #23
0
 public VisualStudioLogger([NotNull] IVisualStudioAccess visualStudioAccess,
                           [NotNull] string documentationBaseUrl)
 {
     _visualStudioAccess   = visualStudioAccess ?? throw new ArgumentNullException(nameof(visualStudioAccess));
     _documentationBaseUrl = documentationBaseUrl ?? throw new ArgumentNullException(nameof(documentationBaseUrl));
 }