public void Execute() { using ( var detector = new SqlServerDetector( Registry.LocalMachine, new ServiceControllerProxy(new ServiceController("MSSQL$SQLEXPRESS")))) { var factorySpecification = detector.BuildConnectionFactorySpecification(); var manipulator = new ConfigFileManipulator(); var processor = new ConfigFileProcessor(); new ConfigFileFinder().FindConfigFiles( Project.ProjectItems, i => processor.ProcessConfigFile( i, new Func<XDocument, bool>[] { c => manipulator.AddOrUpdateConfigSection(c, GetType().Assembly.GetName().Version), c => manipulator.AddConnectionFactoryToConfig(c, factorySpecification) })); } new ReferenceRemover(Project).TryRemoveSystemDataEntity(); }
public void Execute() { using ( var detector = new SqlServerDetector( Registry.LocalMachine, new ServiceControllerProxy(new ServiceController("MSSQL$SQLEXPRESS")))) { var factorySpecification = detector.BuildConnectionFactorySpecification(); var manipulator = new ConfigFileManipulator(); var processor = new ConfigFileProcessor(); new ConfigFileFinder().FindConfigFiles( Project.ProjectItems, i => processor.ProcessConfigFile( i, new Func <XDocument, bool>[] { c => manipulator.AddOrUpdateConfigSection(c, GetType().Assembly.GetName().Version), c => manipulator.AddConnectionFactoryToConfig(c, factorySpecification) })); } new ReferenceRemover(Project).TryRemoveSystemDataEntity(); }
public ConnectionFactoryConfigurator(Project project) { Check.NotNull(project, "project"); using ( var detector = new SqlServerDetector( Registry.LocalMachine, new ServiceControllerProxy(new ServiceController("MSSQL$SQLEXPRESS")))) { var factorySpecification = detector.BuildConnectionFactorySpecification(); var manipulator = new ConfigFileManipulator(); var processor = new ConfigFileProcessor(); new ConfigFileFinder().FindConfigFiles( project.ProjectItems, i => processor.ProcessConfigFile( i, new Func <XDocument, bool>[] { c => manipulator.AddOrUpdateConfigSection(c, GetType().Assembly.GetName().Version), c => manipulator.AddConnectionFactoryToConfig(c, factorySpecification) })); } }
public ConnectionFactoryConfigurator(Project project) { Check.NotNull(project, "project"); using ( var detector = new SqlServerDetector( Registry.LocalMachine, new ServiceControllerProxy(new ServiceController("MSSQL$SQLEXPRESS")))) { var factorySpecification = detector.BuildConnectionFactorySpecification(); var manipulator = new ConfigFileManipulator(); var processor = new ConfigFileProcessor(); new ConfigFileFinder().FindConfigFiles( project.ProjectItems, i => processor.ProcessConfigFile( i, new Func<XDocument, bool>[] { c => manipulator.AddOrUpdateConfigSection(c, GetType().Assembly.GetName().Version), c => manipulator.AddConnectionFactoryToConfig(c, factorySpecification) })); } }
public ConnectionFactoryConfigurator(Project project) { Contract.Requires(project != null); using ( var detector = new SqlServerDetector( Registry.LocalMachine, new ServiceControllerProxy(new ServiceController("MSSQL$SQLEXPRESS")))) { var factorySpecification = detector.BuildConnectionFactorySpecification(); var manipulator = new ConfigFileManipulator(); var processor = new ConfigFileProcessor(); var efVersion = new VersionMapper().GetEntityFrameworkVersion(project); new ConfigFileFinder().FindConfigFiles( project.ProjectItems, i => processor.ProcessConfigFile( i, new Func<XDocument, bool>[] { c => manipulator.AddOrUpdateConfigSection(c, efVersion), c => manipulator.AddConnectionFactoryToConfig(c, factorySpecification) })); } }
public void Base_connection_string_on_dev_box_with_SQL_Express_installed_has_SQL_Express_connection_string() { using ( var detector = new SqlServerDetector( Registry.LocalMachine, new ServiceControllerProxy( new ServiceController("MSSQL$SQLEXPRESS")))) { var specification = detector.BuildConnectionFactorySpecification(); Assert.Equal( ConnectionFactorySpecification.SqlConnectionFactoryName, specification.ConnectionFactoryName); Assert.Empty(specification.ConstructorArguments); } }
public void SqlServerDetector_detects_LocalDB_v11_0_on_dev_machine() { using ( var detector = new SqlServerDetector( Registry.LocalMachine, new Mock<ServiceControllerProxy>().Object) ) { Assert.Equal("11.0", detector.TryGetLocalDBVersionInstalled()); } }
public void SqlServerDetector_detects_SQL_Express_on_dev_machine() { using ( var detector = new SqlServerDetector( new Mock<RegistryKeyProxy>().Object, new ServiceControllerProxy( new ServiceController("MSSQL$SQLEXPRESS")))) { Assert.True(detector.IsSqlExpressInstalled()); } }
public void SqlServerDetector_generates_LocalDB_11_base_connection_string_if_neither_LocalDB_or_Express_are_installed() { var specification = new SqlServerDetector( CreatedMockedRegistryKey(new string[0]), CreateMockedController(status: null)) .BuildConnectionFactorySpecification(); Assert.Equal( ConnectionFactorySpecification.LocalDbConnectionFactoryName, specification.ConnectionFactoryName); Assert.Equal("v11.0", specification.ConstructorArguments.Single()); }
public void SqlServerDetector_generates_LocalDB_base_connection_string_if_LocalDB_is_installed_and_Express_is_not() { var specification = new SqlServerDetector( CreatedMockedRegistryKey("12.0"), CreateMockedController(status: null)) .BuildConnectionFactorySpecification(); Assert.Equal( ConnectionFactorySpecification.LocalDbConnectionFactoryName, specification.ConnectionFactoryName); Assert.Equal("v12.0", specification.ConstructorArguments.Single()); }
public void SqlServerDetector_generates_SQL_Express_base_connection_string_if_Express_is_installed_and_LocalDB_is_not() { var specification = new SqlServerDetector( CreatedMockedRegistryKey(new string[0]), CreateMockedController()) .BuildConnectionFactorySpecification(); Assert.Equal( ConnectionFactorySpecification.SqlConnectionFactoryName, specification.ConnectionFactoryName); Assert.Empty(specification.ConstructorArguments); }
public void SqlServerDetector_detects_LocalDB_on_dev_machine() { using ( var detector = new SqlServerDetector( Registry.LocalMachine, new Mock<ServiceControllerProxy>().Object) ) { Assert.NotNull(detector.GetLocalDBVersionInstalled()); } }