コード例 #1
0
ファイル: AddBusCommand.cs プロジェクト: p3s/craftsman
        public static void AddBus(Bus template, string srcDirectory, string testDirectory, string projectBaseName, string solutionDirectory, IFileSystem fileSystem)
        {
            var messagesDirectory = Path.Combine(solutionDirectory, "Messages");

            var massTransitPackages = new Dictionary <string, string> {
                { "MassTransit", "7.2.4" },
                { "MassTransit.AspNetCore", "7.2.4" },
                { "MassTransit.Extensions.DependencyInjection", "7.2.4" },
                { "MassTransit.RabbitMQ", "7.2.4" }
            };
            var webApiClassPath = ClassPathHelper.WebApiProjectClassPath(srcDirectory, projectBaseName);

            Utilities.AddPackages(webApiClassPath, massTransitPackages);

            WebApiServiceExtensionsBuilder.CreateMassTransitServiceExtension(srcDirectory, projectBaseName, fileSystem);
            foreach (var env in template.Environments)
            {
                WebApiAppSettingsModifier.AddRmq(srcDirectory, env, projectBaseName, fileSystem);
                StartupModifier.RegisterMassTransitService(srcDirectory, env.EnvironmentName, projectBaseName);
            }

            IntegrationTestFixtureModifier.AddMassTransit(testDirectory, projectBaseName);

            SolutionBuilder.BuildMessagesProject(solutionDirectory);

            Utilities.AddProjectReference(webApiClassPath, @"..\..\..\Messages\Messages.csproj");
        }