From 165ded7cf953c50046589ba5ecd37b7b2e72a52c Mon Sep 17 00:00:00 2001 From: chullybun Date: Tue, 2 Jul 2024 09:26:12 -0700 Subject: [PATCH] v5.12.9 - *Fixed:* Enable `text` specification to be used as-is by prefixing with a `+` plus-sign character. - *Fixed:* Upgraded `DbEx` (`v2.5.8`) to include all related fixes and improvements. --- CHANGELOG.md | 4 +++ Common.targets | 2 +- docs/Entity-Const-Config.md | 2 +- docs/Entity-Entity-Config.md | 4 +-- docs/Entity-Operation-Config.md | 4 +-- docs/Entity-Parameter-Config.md | 4 +-- docs/Entity-Property-Config.md | 4 +-- .../Controllers/Generated/RobotController.cs | 2 +- .../Data/Generated/IRobotData.cs | 2 +- .../DataSvc/Generated/IRobotDataSvc.cs | 2 +- .../Entities/Generated/ProductArgs.cs | 4 +-- .../Generated/IRobotManager.cs | 2 +- .../Demo/Beef.Demo.CodeGen/entity.beef-5.yaml | 6 ++-- .../Agents/Generated/IRobotAgent.cs | 2 +- .../Entities/Generated/ProductArgs.cs | 4 +-- .../content/.template.config/template.json | 2 +- .../Beef.CodeGen.Core.csproj | 2 +- .../Config/Entity/CodeGenConfig.cs | 32 +++++++++++++++++++ .../Config/Entity/ConstConfig.cs | 4 +-- .../Config/Entity/EntityConfig.cs | 9 ++++-- .../Config/Entity/OperationConfig.cs | 6 ++-- .../Config/Entity/ParameterConfig.cs | 16 +++++----- .../Config/Entity/PropertyConfig.cs | 11 +++---- .../Schema/entity.beef-5.json | 18 +++++------ .../Beef.CodeGen.Core/Templates/Entity_cs.hbs | 2 +- .../Beef.CodeGen.Core/Templates/Model_cs.hbs | 2 +- .../Beef.Database.Core.csproj | 2 +- .../Beef.Database.MySql.csproj | 2 +- .../Beef.Database.Postgres.csproj | 2 +- .../Beef.Database.SqlServer.csproj | 2 +- 30 files changed, 100 insertions(+), 60 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a7807de76..ffd9ed56d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ Represents the **NuGet** versions. +## v5.12.9 +- *Fixed:* Enable `text` specification to be used as-is by prefixing with a `+` plus-sign character. +- *Fixed:* Upgraded `DbEx` (`v2.5.8`) to include all related fixes and improvements. + ## v5.12.8 - *Fixed*: Fixed the model code-generation by allowing the `ModelInherits` to be specified within the `Entity` YAML configuration to override the default. - *Fixed*: Fixed `dotnet run count` to exclude paths that start with `.` (dot) to avoid including hidden files in the count. diff --git a/Common.targets b/Common.targets index ffaa741bc..8f30a7860 100644 --- a/Common.targets +++ b/Common.targets @@ -1,6 +1,6 @@ - 5.12.8 + 5.12.9 preview Avanade Avanade diff --git a/docs/Entity-Const-Config.md b/docs/Entity-Const-Config.md index 825dc0fbc..8ac168f01 100644 --- a/docs/Entity-Const-Config.md +++ b/docs/Entity-Const-Config.md @@ -23,5 +23,5 @@ Property | Description -|- **`name`** | The unique constant name. [Mandatory] **`value`** | The .NET (C#) code for the constant value. [Mandatory]
† The code generation will ensure the value is delimited properly to output correctly formed (delimited) .NET (C#) code. -`text` | The overriding text for use in comments.
† By default the `Text` will be the `Name` reformatted as sentence casing. It will be formatted as: `Represents a {text} constant value.` To create a `` within use moustache shorthand (e.g. `{{Xxx}}`). +`text` | The overriding text for use in comments.
† By default the `Text` will be the `Name` reformatted as sentence casing. It will be formatted as: `Represents a {text} constant value.` To create a `` within use moustache shorthand (e.g. `{{Xxx}}`). To have the text used as-is prefix with a `+` plus-sign character. diff --git a/docs/Entity-Entity-Config.md b/docs/Entity-Entity-Config.md index e06ce85ba..c889a7a90 100644 --- a/docs/Entity-Entity-Config.md +++ b/docs/Entity-Entity-Config.md @@ -58,7 +58,7 @@ Provides the _key_ configuration. Property | Description -|- **`name`** | The unique entity name. [Mandatory] -`text` | The overriding text for use in comments.
† Overrides the Name (as sentence text) for the summary comments. It will be formatted as: `Represents the {Text} entity.`. To create a `` within use moustache shorthand (e.g. {{Xxx}}). +`text` | The overriding text for use in comments.
† Overrides the Name (as sentence text) for the summary comments. It will be formatted as: `Represents the {Text} entity.`. To create a `` within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a `+` plus-sign character. `fileName` | The overriding file name.
† Overrides the Name as the code-generated file name. `privateName` | The overriding private name.
† Overrides the `Name` to be used for private fields. By default reformatted from `Name`; e.g. `FirstName` as `_firstName`. `argumentName` | The overriding argument name.
† Overrides the `Name` to be used for argument parameters. By default reformatted from `Name`; e.g. `FirstName` as `firstName`. @@ -280,7 +280,7 @@ Provides the data _Model_ configuration. Property | Description -|- `dataModel` | Indicates whether a data `model` version of the entity should also be generated (output to `.\Business\Data\Model`).
† The model will be generated with `OmitEntityBase = true`. Any reference data properties will be defined using their `RefDataType` intrinsic `Type` versus their corresponding (actual) reference data `Type`. -`modelInherits` | Overrides the default data `model` inherits value. +`dataModelInherits` | Overrides the default data `model` inherits value.
diff --git a/docs/Entity-Operation-Config.md b/docs/Entity-Operation-Config.md index 7f8f5d26a..54940ec6b 100644 --- a/docs/Entity-Operation-Config.md +++ b/docs/Entity-Operation-Config.md @@ -66,13 +66,13 @@ Property | Description -|- **`name`** | The unique operation name. [Mandatory] **`type`** | The type of operation that is to be code-generated. Valid options are: `Get`, `GetColl`, `Create`, `Update`, `Patch`, `Delete`, `Custom`, `CustomManagerOnly`.
† Defaults to `Custom`. -`text` | The text for use in comments.
† The `Text` will be defaulted for all the `Operation.Type` options with the exception of `Custom`. To create a `` within use moustache shorthand (e.g. {{Xxx}}). +`text` | The text for use in comments.
† The `Text` will be defaulted for all the `Operation.Type` options with the exception of `Custom`. To create a `` within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a `+` plus-sign character. **`primaryKey`** | Indicates whether the properties marked as a primary key (`Property.PrimaryKey`) are to be used as the parameters.
† This simplifies the specification of these properties as parameters versus having to declare each specifically. Each of the parameters will also be set to be mandatory. **`paging`** | Indicates whether a `PagingArgs` argument is to be added to the operation to enable (standardized) paging related logic. `valueType` | The .NET value parameter `Type` for the operation.
† Defaults to the parent `Entity.Name` where the `Operation.Type` options are `Create` or `Update`. `returnType` | The .NET return `Type` for the operation.
† Defaults to the parent `Entity.Name` where the `Operation.Type` options are `Get`, `GetColl`, `Create` or `Update`; otherwise, defaults to `void`. `returnTypeNullable` | Indicates whether the `ReturnType` is nullable for the operation.
† This is only applicable for an `Operation.Type` of `Custom`. Will be inferred where the `ReturnType` is denoted as nullable; i.e. suffixed by a `?`. -`returnText` | The text for use in comments to describe the `ReturnType`.
† A default will be created where not specified. To create a `` within use moustache shorthand (e.g. {{Xxx}}). +`returnText` | The text for use in comments to describe the `ReturnType`.
† A default will be created where not specified. To create a `` within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a `+` plus-sign character. `privateName` | The overriding private name.
† Overrides the `Name` to be used for private usage. By default reformatted from `Name`; e.g. `GetByArgs` as `_getByArgs`. `withResult` | Indicates whether to use `CoreEx.Results` (aka Railway-oriented programming).
† Defaults to `Entity.WilhResult`. diff --git a/docs/Entity-Parameter-Config.md b/docs/Entity-Parameter-Config.md index eae8fd330..ff68201b8 100644 --- a/docs/Entity-Parameter-Config.md +++ b/docs/Entity-Parameter-Config.md @@ -38,7 +38,7 @@ Provides the _key_ configuration. Property | Description -|- **`name`** | The unique parameter name. [Mandatory] -`text` | The overriding text for use in comments.
† By default the `Text` will be the `Name` reformatted as sentence casing. +`text` | The overriding text for use in comments.
† By default the `Text` will be the `Name` reformatted as sentence casing. To have the text used as-is prefix with a `+` plus-sign character. **`type`** | The .NET `Type`.
† Defaults to `string`. To reference a Reference Data `Type` always prefix with `RefDataNamespace` (e.g. `RefDataNamespace.Gender`) or shortcut `^` (e.g. `^Gender`). This will ensure that the appropriate Reference Data `using` statement is used. _Shortcut:_ Where the `Type` starts with (prefix) `RefDataNamespace.` or `^`, and the correspondong `RefDataType` attribute is not specified it will automatically default the `RefDataType` to `string.` **`nullable`** | Indicates whether the .NET Type should be declared as nullable; e.g. `int?`. Will be inferred where the `Type` is denoted as nullable; i.e. suffixed by a `?`. Where the .NET Type is not considered as an intrinsic type then will default to `true`. `default` | The C# code to default the value.
† Where the `Type` is `string` then the specified default value will need to be delimited. Any valid value assignment C# code can be used. @@ -94,7 +94,7 @@ Provides the _Web API_ configuration. Property | Description -|- `webApiFrom` | The option for how the parameter will be delcared within the Web API Controller. Valid options are: `FromQuery`, `FromBody`, `FromRoute`, `FromEntityProperties`.
† Defaults to `FromQuery`; unless the parameter `Type` has also been defined as an `Entity` within the code-gen config file then it will default to `FromEntityProperties`. Specifies that the parameter will be declared with corresponding `FromQueryAttribute`, `FromBodyAttribute` or `FromRouteAttribute` for the Web API method. The `FromEntityProperties` will declare all properties of the `Entity` as query parameters. -`webApiText` | The overriding text for use in the Web API comments.
† By default the `Text` will be the `Name` reformatted as sentence casing. +`webApiText` | The overriding text for use in the Web API comments.
† By default the `WbeApiText` will be the `Name` reformatted as sentence casing. To have the text used as-is prefix with a `+` plus-sign character.
diff --git a/docs/Entity-Property-Config.md b/docs/Entity-Property-Config.md index e9da56d7b..e9d5c7e69 100644 --- a/docs/Entity-Property-Config.md +++ b/docs/Entity-Property-Config.md @@ -49,8 +49,8 @@ Provides the _key_ configuration. Property | Description -|- **`name`** | The unique property name. [Mandatory] -`text` | The overriding text for use in comments.
† By default the `Text` will be the `Name` reformatted as sentence casing. Depending on whether the `Type` is `bool`, will appear in one of the two generated sentences. Where not `bool` it will be: Gets or sets a value indicating whether {text}.'. Otherwise, it will be: Gets or sets the {text}.'. To create a `` within use moustache shorthand (e.g. {{Xxx}}). -`modelText` | The overriding model text for use in comments.
† By default the `ModelText` will be the `Name` reformatted as sentence casing. Depending on whether the `Type` is `bool`, will appear in one of the two generated sentences. Where not `bool` it will be: Gets or sets a value indicating whether {text}.'. Otherwise, it will be: Gets or sets the {text}.'. To create a `` within use moustache shorthand (e.g. {{Xxx}}). +`text` | The overriding text for use in comments.
† By default the `Text` will be the `Name` reformatted as sentence casing. Depending on whether the `Type` is `bool`, will appear in one of the two generated sentences. Where not `bool` it will be: Gets or sets a value indicating whether {text}.'. Otherwise, it will be: Gets or sets the {text}.'. To create a `` within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a `+` plus-sign character. +`modelText` | The overriding model text for use in comments.
† By default the `ModelText` will be the `Name` reformatted as sentence casing. Depending on whether the `Type` is `bool`, will appear in one of the two generated sentences. Where not `bool` it will be: Gets or sets a value indicating whether {text}.'. Otherwise, it will be: Gets or sets the {text}.'. To create a `` within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a `+` plus-sign character. **`type`** | The .NET `Type`.
† Defaults to `string`. To reference a Reference Data `Type` always prefix with `RefDataNamespace` (e.g. `RefDataNamespace.Gender`) or shortcut `^` (e.g. `^Gender`). This will ensure that the appropriate Reference Data `using` statement is used. _Shortcut:_ Where the `Type` starts with (prefix) `RefDataNamespace.` or `^`, and the correspondong `RefDataType` attribute is not specified it will automatically default the `RefDataType` to `string.` **`nullable`** | Indicates whether the .NET `Type` should be declared as nullable; e.g. `string?`. Will be inferred where the `Type` is denoted as nullable; i.e. suffixed by a `?`. `inherited` | Indicates whether the property is inherited and therefore should not be output within the generated Entity class. diff --git a/samples/Demo/Beef.Demo.Api/Controllers/Generated/RobotController.cs b/samples/Demo/Beef.Demo.Api/Controllers/Generated/RobotController.cs index e9f6a158f..ed7bb0811 100644 --- a/samples/Demo/Beef.Demo.Api/Controllers/Generated/RobotController.cs +++ b/samples/Demo/Beef.Demo.Api/Controllers/Generated/RobotController.cs @@ -28,7 +28,7 @@ public RobotController(WebApi webApi, IRobotManager manager) partial void RobotControllerCtor(); // Enables additional functionality to be added to the constructor. /// - /// Gets the specified . + /// Get the R-O-B-O-T. /// /// The identifier. /// The selected where found. diff --git a/samples/Demo/Beef.Demo.Business/Data/Generated/IRobotData.cs b/samples/Demo/Beef.Demo.Business/Data/Generated/IRobotData.cs index 034b73575..36dd703a1 100644 --- a/samples/Demo/Beef.Demo.Business/Data/Generated/IRobotData.cs +++ b/samples/Demo/Beef.Demo.Business/Data/Generated/IRobotData.cs @@ -13,7 +13,7 @@ namespace Beef.Demo.Business.Data; public partial interface IRobotData { /// - /// Gets the specified . + /// Get the R-O-B-O-T. /// /// The identifier. /// The selected where found. diff --git a/samples/Demo/Beef.Demo.Business/DataSvc/Generated/IRobotDataSvc.cs b/samples/Demo/Beef.Demo.Business/DataSvc/Generated/IRobotDataSvc.cs index 927ac7502..9fb9a8bbc 100644 --- a/samples/Demo/Beef.Demo.Business/DataSvc/Generated/IRobotDataSvc.cs +++ b/samples/Demo/Beef.Demo.Business/DataSvc/Generated/IRobotDataSvc.cs @@ -13,7 +13,7 @@ namespace Beef.Demo.Business.DataSvc; public partial interface IRobotDataSvc { /// - /// Gets the specified . + /// Get the R-O-B-O-T. /// /// The identifier. /// The selected where found. diff --git a/samples/Demo/Beef.Demo.Business/Entities/Generated/ProductArgs.cs b/samples/Demo/Beef.Demo.Business/Entities/Generated/ProductArgs.cs index 3d23f1710..a71f39581 100644 --- a/samples/Demo/Beef.Demo.Business/Entities/Generated/ProductArgs.cs +++ b/samples/Demo/Beef.Demo.Business/Entities/Generated/ProductArgs.cs @@ -8,7 +8,7 @@ namespace Beef.Demo.Business.Entities; /// -/// Represents the arguments entity. +/// The arguments. /// public partial class ProductArgs : EntityBase { @@ -16,7 +16,7 @@ public partial class ProductArgs : EntityBase private string? _description; /// - /// Gets or sets the Name. + /// The product name. /// public string? Name { get => _name; set => SetValue(ref _name, value); } diff --git a/samples/Demo/Beef.Demo.Business/Generated/IRobotManager.cs b/samples/Demo/Beef.Demo.Business/Generated/IRobotManager.cs index 94dbf1049..cb6c5e8a2 100644 --- a/samples/Demo/Beef.Demo.Business/Generated/IRobotManager.cs +++ b/samples/Demo/Beef.Demo.Business/Generated/IRobotManager.cs @@ -13,7 +13,7 @@ namespace Beef.Demo.Business; public partial interface IRobotManager { /// - /// Gets the specified . + /// Get the R-O-B-O-T. /// /// The identifier. /// The selected where found. diff --git a/samples/Demo/Beef.Demo.CodeGen/entity.beef-5.yaml b/samples/Demo/Beef.Demo.CodeGen/entity.beef-5.yaml index 2fd952cf0..29357733e 100644 --- a/samples/Demo/Beef.Demo.CodeGen/entity.beef-5.yaml +++ b/samples/Demo/Beef.Demo.CodeGen/entity.beef-5.yaml @@ -158,9 +158,9 @@ entities: # # # -- { name: ProductArgs, text: '{{Product}} arguments', excludeAll: true, +- { name: ProductArgs, text: '+The {{Product}} arguments.', excludeAll: true, properties: [ - { name: Name, type: string }, + { name: Name, type: string, text: +The product name. }, { name: Description, type: string } ] } @@ -177,7 +177,7 @@ entities: { name: ChangeLog, type: ChangeLog, isEntity: true, grpcFieldNo: 7 } ], operations: [ - { name: Get, type: Get, primaryKey: true, webApiRoute: '{id}', grpc: true }, + { name: Get, type: Get, primaryKey: true, webApiRoute: '{id}', grpc: true, text: +Get the R-O-B-O-T }, { name: Create, type: Create, webApiLocation: ^Get, grpc: true }, { name: Update, type: Update, primaryKey: true, webApiRoute: '{id}', grpc: true }, { name: Patch, type: Patch, primaryKey: true, webApiRoute: '{id}' }, diff --git a/samples/Demo/Beef.Demo.Common/Agents/Generated/IRobotAgent.cs b/samples/Demo/Beef.Demo.Common/Agents/Generated/IRobotAgent.cs index b6d17fca8..a3b2ba53d 100644 --- a/samples/Demo/Beef.Demo.Common/Agents/Generated/IRobotAgent.cs +++ b/samples/Demo/Beef.Demo.Common/Agents/Generated/IRobotAgent.cs @@ -26,7 +26,7 @@ namespace Beef.Demo.Common.Agents public partial interface IRobotAgent { /// - /// Gets the specified . + /// Get the R-O-B-O-T. /// /// The identifier. /// The optional . diff --git a/samples/Demo/Beef.Demo.Common/Entities/Generated/ProductArgs.cs b/samples/Demo/Beef.Demo.Common/Entities/Generated/ProductArgs.cs index 10c988430..4453a6c1c 100644 --- a/samples/Demo/Beef.Demo.Common/Entities/Generated/ProductArgs.cs +++ b/samples/Demo/Beef.Demo.Common/Entities/Generated/ProductArgs.cs @@ -14,12 +14,12 @@ namespace Beef.Demo.Common.Entities { /// - /// Represents the arguments entity. + /// The arguments. /// public partial class ProductArgs { /// - /// Gets or sets the Name. + /// The product name. /// public string? Name { get; set; } diff --git a/templates/Beef.Template.Solution/content/.template.config/template.json b/templates/Beef.Template.Solution/content/.template.config/template.json index c02fd0bd0..d9a30bbef 100644 --- a/templates/Beef.Template.Solution/content/.template.config/template.json +++ b/templates/Beef.Template.Solution/content/.template.config/template.json @@ -93,7 +93,7 @@ "type": "generated", "generator": "constant", "parameters": { - "value": "5.12.8" + "value": "5.12.9" }, "replaces": "BeefVersion" }, diff --git a/tools/Beef.CodeGen.Core/Beef.CodeGen.Core.csproj b/tools/Beef.CodeGen.Core/Beef.CodeGen.Core.csproj index 61a3361cd..d1e4e9fcd 100644 --- a/tools/Beef.CodeGen.Core/Beef.CodeGen.Core.csproj +++ b/tools/Beef.CodeGen.Core/Beef.CodeGen.Core.csproj @@ -32,7 +32,7 @@ - + diff --git a/tools/Beef.CodeGen.Core/Config/Entity/CodeGenConfig.cs b/tools/Beef.CodeGen.Core/Config/Entity/CodeGenConfig.cs index b40ce25b8..5330a7b35 100644 --- a/tools/Beef.CodeGen.Core/Config/Entity/CodeGenConfig.cs +++ b/tools/Beef.CodeGen.Core/Config/Entity/CodeGenConfig.cs @@ -710,5 +710,37 @@ internal static void WarnWhereDeprecated(CodeGenConfig root, ConfigBase config, } } } + + /// + /// Gets the formatted text. + /// + /// The original text. + /// The text formatter function. + /// The formatted text. + /// Where the text starts with a + (plus sign) then the text will be used as-is (without the plus); otherwise, the formatter will be used. + internal static string? GetFormattedText(string? text, Func formatter) + { + text = text?.TrimEnd(); + if (string.IsNullOrEmpty(text)) + return text; + + if (text.StartsWith('+')) + return text[1..]; + + return formatter(text); + } + + /// + /// Gets the sentence text. + /// + /// The original text. + /// The text with a terminating full stop. + internal static string? GetSentenceText(string? text) + { + if (string.IsNullOrEmpty(text)) + return text; + else + return text.EndsWith('.') ? text : text + "."; + } } } \ No newline at end of file diff --git a/tools/Beef.CodeGen.Core/Config/Entity/ConstConfig.cs b/tools/Beef.CodeGen.Core/Config/Entity/ConstConfig.cs index 403cca9d0..35b9d2ccc 100644 --- a/tools/Beef.CodeGen.Core/Config/Entity/ConstConfig.cs +++ b/tools/Beef.CodeGen.Core/Config/Entity/ConstConfig.cs @@ -48,13 +48,13 @@ public class ConstConfig : ConfigBase /// [JsonPropertyName("text")] [CodeGenProperty("Key", Title = "The overriding text for use in comments.", - Description = "By default the `Text` will be the `Name` reformatted as sentence casing. It will be formatted as: `Represents a {text} constant value.` To create a `` within use moustache shorthand (e.g. `{{Xxx}}`).")] + Description = "By default the `Text` will be the `Name` reformatted as sentence casing. It will be formatted as: `Represents a {text} constant value.` To create a `` within use moustache shorthand (e.g. `{{Xxx}}`). To have the text used as-is prefix with a `+` plus-sign character.")] public string? Text { get; set; } /// /// Gets the formatted summary text. /// - public string? SummaryText => $"Represents a {Text} constant value."; + public string? SummaryText => CodeGenConfig.GetSentenceText(CodeGenConfig.GetFormattedText(Text, text => $"Represents a {text} constant value.")); /// /// Gets the value formatted for code output. diff --git a/tools/Beef.CodeGen.Core/Config/Entity/EntityConfig.cs b/tools/Beef.CodeGen.Core/Config/Entity/EntityConfig.cs index db0e6f1fa..85bbc5412 100644 --- a/tools/Beef.CodeGen.Core/Config/Entity/EntityConfig.cs +++ b/tools/Beef.CodeGen.Core/Config/Entity/EntityConfig.cs @@ -74,7 +74,7 @@ public class EntityConfig : ConfigBase /// [JsonPropertyName("text")] [CodeGenProperty("Key", Title = "The overriding text for use in comments.", - Description = "Overrides the Name (as sentence text) for the summary comments. It will be formatted as: `Represents the {Text} entity.`. To create a `` within use moustache shorthand (e.g. {{Xxx}}).")] + Description = "Overrides the Name (as sentence text) for the summary comments. It will be formatted as: `Represents the {Text} entity.`. To create a `` within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a `+` plus-sign character.")] public string? Text { get; set; } /// @@ -1227,7 +1227,12 @@ public class EntityConfig : ConfigBase /// /// Gets the formatted summary text. /// - public string? SummaryText => StringConverter.ToComments($"Represents the {Text} entity."); + public string? SummaryText => CodeGenConfig.GetSentenceText(StringConverter.ToComments(CodeGenConfig.GetFormattedText(Text, text => $"Represents the {text} entity."))); + + /// + /// Gets the formatted model text. + /// + public string? ModelSummaryText => CodeGenConfig.GetSentenceText(StringConverter.ToComments(CodeGenConfig.GetFormattedText(Text, text => $"Represents the {text} model."))); /// /// Gets the entity name (accounts for ). diff --git a/tools/Beef.CodeGen.Core/Config/Entity/OperationConfig.cs b/tools/Beef.CodeGen.Core/Config/Entity/OperationConfig.cs index 61b62b909..09dd8dee5 100644 --- a/tools/Beef.CodeGen.Core/Config/Entity/OperationConfig.cs +++ b/tools/Beef.CodeGen.Core/Config/Entity/OperationConfig.cs @@ -88,7 +88,7 @@ public class OperationConfig : ConfigBase /// [JsonPropertyName("text")] [CodeGenProperty("Key", Title = "The text for use in comments.", - Description = "The `Text` will be defaulted for all the `Operation.Type` options with the exception of `Custom`. To create a `` within use moustache shorthand (e.g. {{Xxx}}).")] + Description = "The `Text` will be defaulted for all the `Operation.Type` options with the exception of `Custom`. To create a `` within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a `+` plus-sign character.")] public string? Text { get; set; } /// @@ -135,7 +135,7 @@ public class OperationConfig : ConfigBase /// [JsonPropertyName("returnText")] [CodeGenProperty("Key", Title = "The text for use in comments to describe the `ReturnType`.", - Description = "A default will be created where not specified. To create a `` within use moustache shorthand (e.g. {{Xxx}}).")] + Description = "A default will be created where not specified. To create a `` within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a `+` plus-sign character.")] public string? ReturnText { get; set; } /// @@ -804,7 +804,7 @@ public class OperationEvent /// /// Gets the formatted summary text. /// - public string? SummaryText => Text + "."; + public string? SummaryText => CodeGenConfig.GetSentenceText(CodeGenConfig.GetFormattedText(Text, text => text)); /// /// Gets the return type including nullability (where specified). diff --git a/tools/Beef.CodeGen.Core/Config/Entity/ParameterConfig.cs b/tools/Beef.CodeGen.Core/Config/Entity/ParameterConfig.cs index a31bdc7fe..307e3bdad 100644 --- a/tools/Beef.CodeGen.Core/Config/Entity/ParameterConfig.cs +++ b/tools/Beef.CodeGen.Core/Config/Entity/ParameterConfig.cs @@ -52,7 +52,7 @@ public class ParameterConfig : ConfigBase /// [JsonPropertyName("text")] [CodeGenProperty("Key", Title = "The overriding text for use in comments.", - Description = "By default the `Text` will be the `Name` reformatted as sentence casing.")] + Description = "By default the `Text` will be the `Name` reformatted as sentence casing. To have the text used as-is prefix with a `+` plus-sign character.")] public string? Text { get; set; } /// @@ -198,7 +198,7 @@ public class ParameterConfig : ConfigBase /// [JsonPropertyName("webApiText")] [CodeGenProperty("WebApi", Title = "The overriding text for use in the Web API comments.", - Description = "By default the `Text` will be the `Name` reformatted as sentence casing.")] + Description = "By default the `WbeApiText` will be the `Name` reformatted as sentence casing. To have the text used as-is prefix with a `+` plus-sign character.")] public string? WebApiText { get; set; } #endregion @@ -227,16 +227,16 @@ public class ParameterConfig : ConfigBase /// /// Gets the formatted summary text. /// - public string? SummaryText => IsValueArg && Parent!.Type == "Patch" - ? StringConverter.ToComments($"The {{{{string}}}} that contains the patch content for the {Text}.") - : StringConverter.ToComments($"{(Type == "bool" ? "Indicates whether" : "The")} {Text}."); + public string? SummaryText => CodeGenConfig.GetSentenceText(CodeGenConfig.GetFormattedText(Text, text => IsValueArg && Parent!.Type == "Patch" + ? StringConverter.ToComments($"The {{{{string}}}} that contains the patch content for the {text}.") + : StringConverter.ToComments($"{(Type == "bool" ? "Indicates whether" : "The")} {text}."))); /// /// Gets the formatted WebApi summary text. /// - public string? WebApiSummaryText => IsValueArg && Parent!.Type == "Patch" - ? StringConverter.ToComments($"The {{{{string}}}} that contains the patch content for the {WebApiText}.") - : StringConverter.ToComments($"{(Type == "bool" ? "Indicates whether" : "The")} {WebApiText}."); + public string? WebApiSummaryText => CodeGenConfig.GetSentenceText(CodeGenConfig.GetFormattedText(WebApiText, text => IsValueArg && Parent!.Type == "Patch" + ? StringConverter.ToComments($"The {{{{string}}}} that contains the patch content for the {text}.") + : StringConverter.ToComments($"{(Type == "bool" ? "Indicates whether" : "The")} {text}."))); /// /// Gets the computed declared parameter type. diff --git a/tools/Beef.CodeGen.Core/Config/Entity/PropertyConfig.cs b/tools/Beef.CodeGen.Core/Config/Entity/PropertyConfig.cs index 79e7a5f78..bc519f70b 100644 --- a/tools/Beef.CodeGen.Core/Config/Entity/PropertyConfig.cs +++ b/tools/Beef.CodeGen.Core/Config/Entity/PropertyConfig.cs @@ -4,7 +4,6 @@ using OnRamp.Config; using OnRamp.Utility; using System; -using System.Globalization; using System.Linq; using System.Text; using System.Text.Json.Serialization; @@ -64,7 +63,7 @@ public class PropertyConfig : ConfigBase [JsonPropertyName("text")] [CodeGenProperty("Key", Title = "The overriding text for use in comments.", Description = "By default the `Text` will be the `Name` reformatted as sentence casing. Depending on whether the `Type` is `bool`, will appear in one of the two generated sentences. Where not `bool` it will be: Gets or sets a value indicating whether {text}.'. " + - "Otherwise, it will be: Gets or sets the {text}.'. To create a `` within use moustache shorthand (e.g. {{Xxx}}).")] + "Otherwise, it will be: Gets or sets the {text}.'. To create a `` within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a `+` plus-sign character.")] public string? Text { get; set; } /// @@ -73,7 +72,7 @@ public class PropertyConfig : ConfigBase [JsonPropertyName("modelText")] [CodeGenProperty("Key", Title = "The overriding model text for use in comments.", Description = "By default the `ModelText` will be the `Name` reformatted as sentence casing. Depending on whether the `Type` is `bool`, will appear in one of the two generated sentences. Where not `bool` it will be: Gets or sets a value indicating whether {text}.'. " + - "Otherwise, it will be: Gets or sets the {text}.'. To create a `` within use moustache shorthand (e.g. {{Xxx}}).")] + "Otherwise, it will be: Gets or sets the {text}.'. To create a `` within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a `+` plus-sign character.")] public string? ModelText { get; set; } /// @@ -475,12 +474,12 @@ public class PropertyConfig : ConfigBase /// /// Gets the formatted summary text. /// - public string? SummaryText => StringConverter.ToComments($"{(Type == "bool" ? "Indicates whether" : "Gets or sets the")} {Text}."); + public string? SummaryText => CodeGenConfig.GetSentenceText(StringConverter.ToComments(CodeGenConfig.GetFormattedText(Text, text => $"{(Type == "bool" ? "Indicates whether" : "Gets or sets the")} {text}."))); /// /// Gets the formatted model summary text. /// - public string? ModelSummaryText => StringConverter.ToComments($"{(Type == "bool" ? "Indicates whether" : "Gets or sets the")} {ModelText}."); + public string? ModelSummaryText => CodeGenConfig.GetSentenceText(StringConverter.ToComments(CodeGenConfig.GetFormattedText(ModelText, text => $"{(Type == "bool" ? "Indicates whether" : "Gets or sets the")} {text}."))); /// /// Gets the formatted summary text for the Reference Data Serialization Identifier (SID) property. @@ -497,7 +496,7 @@ public class PropertyConfig : ConfigBase /// /// Gets the formatted summary text when used in a parameter context. /// - public string? ParameterSummaryText => StringConverter.ToComments($"{(Type == "bool" ? "Indicates whether" : "The")} {Text}."); + public string? ParameterSummaryText => CodeGenConfig.GetSentenceText(StringConverter.ToComments(CodeGenConfig.GetFormattedText(Text, text => $"{(Type == "bool" ? "Indicates whether" : "The")} {text}."))); /// /// Gets the formatted as see comments. diff --git a/tools/Beef.CodeGen.Core/Schema/entity.beef-5.json b/tools/Beef.CodeGen.Core/Schema/entity.beef-5.json index 10e920ef2..266466e53 100644 --- a/tools/Beef.CodeGen.Core/Schema/entity.beef-5.json +++ b/tools/Beef.CodeGen.Core/Schema/entity.beef-5.json @@ -371,7 +371,7 @@ "text": { "type": "string", "title": "The overriding text for use in comments.", - "description": "Overrides the Name (as sentence text) for the summary comments. It will be formatted as: \u0060Represents the {Text} entity.\u0060. To create a \u0060\u003Csee cref=\u0022XXX\u0022/\u003E\u0060 within use moustache shorthand (e.g. {{Xxx}})." + "description": "Overrides the Name (as sentence text) for the summary comments. It will be formatted as: \u0060Represents the {Text} entity.\u0060. To create a \u0060\u003Csee cref=\u0022XXX\u0022/\u003E\u0060 within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a \u0060\u002B\u0060 plus-sign character." }, "fileName": { "type": "string", @@ -888,7 +888,7 @@ "title": "Indicates whether a data \u0060model\u0060 version of the entity should also be generated (output to \u0060.\\Business\\Data\\Model\u0060).", "description": "The model will be generated with \u0060OmitEntityBase = true\u0060. Any reference data properties will be defined using their \u0060RefDataType\u0060 intrinsic \u0060Type\u0060 versus their corresponding (actual) reference data \u0060Type\u0060." }, - "modelInherits": { + "dataModelInherits": { "type": "string", "title": "Overrides the default data \u0060model\u0060 inherits value." }, @@ -991,12 +991,12 @@ "text": { "type": "string", "title": "The overriding text for use in comments.", - "description": "By default the \u0060Text\u0060 will be the \u0060Name\u0060 reformatted as sentence casing. Depending on whether the \u0060Type\u0060 is \u0060bool\u0060, will appear in one of the two generated sentences. Where not \u0060bool\u0060 it will be: Gets or sets a value indicating whether {text}.\u0027. Otherwise, it will be: Gets or sets the {text}.\u0027. To create a \u0060\u003Csee cref=\u0022XXX\u0022/\u003E\u0060 within use moustache shorthand (e.g. {{Xxx}})." + "description": "By default the \u0060Text\u0060 will be the \u0060Name\u0060 reformatted as sentence casing. Depending on whether the \u0060Type\u0060 is \u0060bool\u0060, will appear in one of the two generated sentences. Where not \u0060bool\u0060 it will be: Gets or sets a value indicating whether {text}.\u0027. Otherwise, it will be: Gets or sets the {text}.\u0027. To create a \u0060\u003Csee cref=\u0022XXX\u0022/\u003E\u0060 within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a \u0060\u002B\u0060 plus-sign character." }, "modelText": { "type": "string", "title": "The overriding model text for use in comments.", - "description": "By default the \u0060ModelText\u0060 will be the \u0060Name\u0060 reformatted as sentence casing. Depending on whether the \u0060Type\u0060 is \u0060bool\u0060, will appear in one of the two generated sentences. Where not \u0060bool\u0060 it will be: Gets or sets a value indicating whether {text}.\u0027. Otherwise, it will be: Gets or sets the {text}.\u0027. To create a \u0060\u003Csee cref=\u0022XXX\u0022/\u003E\u0060 within use moustache shorthand (e.g. {{Xxx}})." + "description": "By default the \u0060ModelText\u0060 will be the \u0060Name\u0060 reformatted as sentence casing. Depending on whether the \u0060Type\u0060 is \u0060bool\u0060, will appear in one of the two generated sentences. Where not \u0060bool\u0060 it will be: Gets or sets a value indicating whether {text}.\u0027. Otherwise, it will be: Gets or sets the {text}.\u0027. To create a \u0060\u003Csee cref=\u0022XXX\u0022/\u003E\u0060 within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a \u0060\u002B\u0060 plus-sign character." }, "type": { "type": "string", @@ -1313,7 +1313,7 @@ "text": { "type": "string", "title": "The text for use in comments.", - "description": "The \u0060Text\u0060 will be defaulted for all the \u0060Operation.Type\u0060 options with the exception of \u0060Custom\u0060. To create a \u0060\u003Csee cref=\u0022XXX\u0022/\u003E\u0060 within use moustache shorthand (e.g. {{Xxx}})." + "description": "The \u0060Text\u0060 will be defaulted for all the \u0060Operation.Type\u0060 options with the exception of \u0060Custom\u0060. To create a \u0060\u003Csee cref=\u0022XXX\u0022/\u003E\u0060 within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a \u0060\u002B\u0060 plus-sign character." }, "primaryKey": { "type": "boolean", @@ -1342,7 +1342,7 @@ "returnText": { "type": "string", "title": "The text for use in comments to describe the \u0060ReturnType\u0060.", - "description": "A default will be created where not specified. To create a \u0060\u003Csee cref=\u0022XXX\u0022/\u003E\u0060 within use moustache shorthand (e.g. {{Xxx}})." + "description": "A default will be created where not specified. To create a \u0060\u003Csee cref=\u0022XXX\u0022/\u003E\u0060 within use moustache shorthand (e.g. {{Xxx}}). To have the text used as-is prefix with a \u0060\u002B\u0060 plus-sign character." }, "privateName": { "type": "string", @@ -1695,7 +1695,7 @@ "text": { "type": "string", "title": "The overriding text for use in comments.", - "description": "By default the \u0060Text\u0060 will be the \u0060Name\u0060 reformatted as sentence casing." + "description": "By default the \u0060Text\u0060 will be the \u0060Name\u0060 reformatted as sentence casing. To have the text used as-is prefix with a \u0060\u002B\u0060 plus-sign character." }, "type": { "type": "string", @@ -1790,7 +1790,7 @@ "webApiText": { "type": "string", "title": "The overriding text for use in the Web API comments.", - "description": "By default the \u0060Text\u0060 will be the \u0060Name\u0060 reformatted as sentence casing." + "description": "By default the \u0060WbeApiText\u0060 will be the \u0060Name\u0060 reformatted as sentence casing. To have the text used as-is prefix with a \u0060\u002B\u0060 plus-sign character." }, "grpcType": { "type": "string", @@ -1818,7 +1818,7 @@ "text": { "type": "string", "title": "The overriding text for use in comments.", - "description": "By default the \u0060Text\u0060 will be the \u0060Name\u0060 reformatted as sentence casing. It will be formatted as: \u0060Represents a {text} constant value.\u0060 To create a \u0060\u003Csee cref=\u0022XXX\u0022/\u003E\u0060 within use moustache shorthand (e.g. \u0060{{Xxx}}\u0060)." + "description": "By default the \u0060Text\u0060 will be the \u0060Name\u0060 reformatted as sentence casing. It will be formatted as: \u0060Represents a {text} constant value.\u0060 To create a \u0060\u003Csee cref=\u0022XXX\u0022/\u003E\u0060 within use moustache shorthand (e.g. \u0060{{Xxx}}\u0060). To have the text used as-is prefix with a \u0060\u002B\u0060 plus-sign character." } }, "required": [ diff --git a/tools/Beef.CodeGen.Core/Templates/Entity_cs.hbs b/tools/Beef.CodeGen.Core/Templates/Entity_cs.hbs index 50b162a30..fba3dc529 100644 --- a/tools/Beef.CodeGen.Core/Templates/Entity_cs.hbs +++ b/tools/Beef.CodeGen.Core/Templates/Entity_cs.hbs @@ -34,7 +34,7 @@ using {{Root.UsingNamespace3}};{{set-value 'HasUsingStatement' true}} namespace {{Root.NamespaceBusiness}}.Entities{{#ifval Namespace}}.{{Namespace}}{{/ifval}}; /// -/// Represents the {{{Text}}} entity. +/// {{{SummaryText}}} /// public {{#if Abstract}}abstract {{/if}}partial class {{{EntityName}}} : {{{EntityInherits}}}{{#ifval EntityImplements}}{{#ifval EntityInherits}}, {{/ifval}}{{{EntityImplements}}}{{/ifval}} { diff --git a/tools/Beef.CodeGen.Core/Templates/Model_cs.hbs b/tools/Beef.CodeGen.Core/Templates/Model_cs.hbs index 829c717ef..b407a9e9e 100644 --- a/tools/Beef.CodeGen.Core/Templates/Model_cs.hbs +++ b/tools/Beef.CodeGen.Core/Templates/Model_cs.hbs @@ -42,7 +42,7 @@ using {{Root.UsingNamespace3}};{{set-value 'HasUsingStatement' true}} namespace {{#if Root.IsDataModel}}{{Root.NamespaceBusiness}}.Data.Model{{else}}{{#ifeq Root.RuntimeEntityScope 'Common'}}{{Root.NamespaceCommon}}{{else}}{{Root.NamespaceBusiness}}{{/ifeq}}.Entities{{/if}} { /// - /// Represents the {{{Text}}} {{#if Root.IsDataModel}}model{{else}}entity{{/if}}. + /// {{#if Root.IsDataModel}}{{ModelSummaryText}}{{else}}{{SummaryText}}{{/if}} /// {{#if Root.IsDataModel}} public {{#if Abstract}}abstract {{/if}}partial class {{{EntityName}}}{{#ifval DataModelInherits}} : {{{DataModelInherits}}}{{/ifval}}{{#ifval ModelImplements}}{{#ifval DataModelInherits}}, {{else}} : {{/ifval}}{{{ModelImplements}}}{{/ifval}}{{#ifval RefDataType}}{{#ifeq CoreProperties.Count 0}} { }{{/ifeq}}{{/ifval}} diff --git a/tools/Beef.Database.Core/Beef.Database.Core.csproj b/tools/Beef.Database.Core/Beef.Database.Core.csproj index 86b2272ce..8e2c19ac8 100644 --- a/tools/Beef.Database.Core/Beef.Database.Core.csproj +++ b/tools/Beef.Database.Core/Beef.Database.Core.csproj @@ -15,7 +15,7 @@ - + diff --git a/tools/Beef.Database.MySql/Beef.Database.MySql.csproj b/tools/Beef.Database.MySql/Beef.Database.MySql.csproj index 2868be197..fcab6ffee 100644 --- a/tools/Beef.Database.MySql/Beef.Database.MySql.csproj +++ b/tools/Beef.Database.MySql/Beef.Database.MySql.csproj @@ -15,7 +15,7 @@ - + diff --git a/tools/Beef.Database.Postgres/Beef.Database.Postgres.csproj b/tools/Beef.Database.Postgres/Beef.Database.Postgres.csproj index 0e8a8b73b..429f6a1a8 100644 --- a/tools/Beef.Database.Postgres/Beef.Database.Postgres.csproj +++ b/tools/Beef.Database.Postgres/Beef.Database.Postgres.csproj @@ -15,7 +15,7 @@ - + diff --git a/tools/Beef.Database.SqlServer/Beef.Database.SqlServer.csproj b/tools/Beef.Database.SqlServer/Beef.Database.SqlServer.csproj index bc9b81853..1e6415b20 100644 --- a/tools/Beef.Database.SqlServer/Beef.Database.SqlServer.csproj +++ b/tools/Beef.Database.SqlServer/Beef.Database.SqlServer.csproj @@ -15,7 +15,7 @@ - +