Skip to content

Commit

Permalink
Вынесла проставление AppName в конструктор partial класса
Browse files Browse the repository at this point in the history
  • Loading branch information
Ann Dyadkova committed Dec 30, 2023
1 parent d672827 commit 444b434
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Unlimotion.AppNameGenerator/AppNameGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@ public void Execute(GeneratorExecutionContext context)

sb.AppendLine("using Unlimotion.ViewModel;");
sb.AppendLine("namespace Unlimotion.Services;");
sb.AppendLine(string.Empty);

sb.AppendLine("public partial class AppNameDefinitionService");
sb.AppendLine("{");
sb.AppendLine($" private string AppName = \"{fullName}\";");
sb.AppendLine(" public AppNameDefinitionService()");
sb.AppendLine(" {");
sb.AppendLine($" AppName = \"{fullName}\";");
sb.AppendLine(" }");
sb.AppendLine("}");

// Add the source code to the compilation
Expand Down
2 changes: 2 additions & 0 deletions src/Unlimotion/Services/AppNameDefinitionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ namespace Unlimotion.Services;

public partial class AppNameDefinitionService : IAppNameDefinitionService
{
private string AppName = "Unlimotion";

public string GetAppName()
{
return AppName;
Expand Down

0 comments on commit 444b434

Please sign in to comment.