Browse Source

refactor

pull/1126/head
Yunus Emre Kalkan 7 years ago
parent
commit
bc891edb18
  1. 11
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs
  2. 8
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/DbContextFileBuilderConfigureAdder.cs

11
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs

@ -31,7 +31,7 @@ namespace Volo.Abp.Cli.Commands
}
var skipDbMigrations = Convert.ToBoolean(
commandLineArgs.Options.GetOrNull(Options.Solution.SkipDbMigrations) ?? "false");
commandLineArgs.Options.GetOrNull(Options.DbMigrations.Skip) ?? "false");
await SolutionModuleAdder.AddAsync(
GetSolutionFile(commandLineArgs),
@ -93,11 +93,12 @@ namespace Volo.Abp.Cli.Commands
sb.AppendLine("");
sb.AppendLine("Options:");
sb.AppendLine(" -s|--solution <solution-file> Specify the solution file explicitly.");
sb.AppendLine(" --skip-db-migrations <boolean> Specify if a new migration will be added or not.");
sb.AppendLine("");
sb.AppendLine("Examples:");
sb.AppendLine(" abp add-module Volo.Blogging Adds the module to the current soluton.");
sb.AppendLine(" abp add-module Volo.Blogging -s Acme.BookStore Adds the module to the given soluton.");
sb.AppendLine(" abp add-module Volo.Blogging -s Acme.BookStore --SkipDbMigrations false Adds the module to the given soluton but doesn't add-migration.");
sb.AppendLine(" abp add-module Volo.Blogging -s Acme.BookStore --skip-db-migrations false Adds the module to the given soluton but doesn't add-migration.");
sb.AppendLine("");
return sb.ToString();
@ -109,7 +110,11 @@ namespace Volo.Abp.Cli.Commands
{
public const string Short = "s";
public const string Long = "solution";
public const string SkipDbMigrations = "skip-db-migrations";
}
public static class DbMigrations
{
public const string Skip = "skip-db-migrations";
}
}
}

8
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/DbContextFileBuilderConfigureAdder.cs

@ -1,6 +1,5 @@
using System;
using System.IO;
using System.Linq;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Volo.Abp.DependencyInjection;
@ -9,9 +8,10 @@ namespace Volo.Abp.Cli.ProjectModification
{
public class DbContextFileBuilderConfigureAdder : ITransientDependency
{
protected UsingStatementAdder UsingStatementAdder { get; }
public ILogger<DbContextFileBuilderConfigureAdder> Logger { get; set; }
protected UsingStatementAdder UsingStatementAdder { get; }
public DbContextFileBuilderConfigureAdder(UsingStatementAdder usingStatementAdder)
{
UsingStatementAdder = usingStatementAdder;
@ -73,12 +73,12 @@ namespace Volo.Abp.Cli.ProjectModification
protected string GetLineToAdd(string moduleConfiguration)
{
return "builder." + moduleConfiguration.Split('.').Last() + "();";
return "builder." + moduleConfiguration.Split(':')[1] + "();";
}
protected string GetNamespace(string moduleConfiguration)
{
return string.Join(".", moduleConfiguration.Split('.').Reverse().Skip(2).Reverse());
return string.Join(".", moduleConfiguration.Split(':')[0]);
}
}
}

Loading…
Cancel
Save