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();
        }
Exemple #3
0
        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);
            }
        }