Skip to content

Commit cc4863d

Browse files
authored
Merge pull request #12 from CodeFactoryLLC/Notices
Notices and 165 Updates
2 parents c92209a + 7661a0c commit cc4863d

24 files changed

+110
-72
lines changed

src/DataSqlEF/CodeFactory.Automation.Data.Sql.EF.Logic/CodeFactory.Automation.Data.Sql.EF.Logic.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
</PropertyGroup>
3737
<ItemGroup>
3838
<PackageReference Include="CodeFactory.Automation.Standard.Logic">
39-
<Version>2.23159.1-PreRelease</Version>
39+
<Version>2.23165.1-PreRelease</Version>
4040
</PackageReference>
4141
<PackageReference Include="CodeFactory.Automation.Standard.NDF.Logic">
42-
<Version>2.23159.1-PreRelease</Version>
42+
<Version>2.23164.1-PreRelease</Version>
4343
</PackageReference>
4444
<PackageReference Include="CodeFactory.WinVs.SDK" Version="2.23160.1-PreRelease" />
4545
<Reference Include="System" />

src/DataSqlEF/CodeFactory.Automation.Data.Sql.EF.Logic/CodeFactory.Automation.Data.Sql.Ef.Logic.nuspec

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" >
33
<metadata>
44
<id>CodeFactory.Automation.Data.Sql.EF.Logic</id>
5-
<version>2.23163.1-PreRelease</version>
5+
<version>2.23165.1-PreRelease</version>
66
<title>Repositry automation for MS SQL using Entity Framework Core.</title>
77
<authors>CodeFactory, LLC.</authors>
88
<owners>CodeFactory, LLC.</owners>
@@ -12,14 +12,19 @@
1212
<license type="expression">MIT</license>
1313
<repository type="git" url="https://github.com/CodeFactoryLLC/CodeFactoryPackages.git" branch="main" />
1414
<releaseNotes>
15-
Initial release of automation logic.
15+
Updated:
16+
17+
- RefreshEFRepositoryAsync
18+
- Added optional parameter loggerFieldName provides the default name of the logger field.
19+
- Added optional parameter logLevel provides the default logging level for methods.
20+
1621
</releaseNotes>
1722
<copyright>Copyright © 2023 CodeFactory, LLC.</copyright>
1823
<tags>Factory Automation</tags>
1924
<dependencies>
2025
<dependency id="CodeFactory.WinVs.SDK" version="2.23160.1-PreRelease"/>
21-
<dependency id="CodeFactory.Automation.Standard.Logic" version="2.23159.1-PreRelease"/>
22-
<dependency id="CodeFactory.Automation.Standard.NDF.Logic" version="2.23159.1-PreRelease"/>
26+
<dependency id="CodeFactory.Automation.Standard.Logic" version="2.23165.1-PreRelease"/>
27+
<dependency id="CodeFactory.Automation.Standard.NDF.Logic" version="2.23164.1-PreRelease"/>
2328
</dependencies>
2429
<icon>CFLogo128.png</icon>
2530
</metadata>

src/DataSqlEF/CodeFactory.Automation.Data.Sql.EF.Logic/EntityTransformAutomation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
namespace CodeFactory.Automation.Data.Sql.EF.Logic
1616
{
17-
/// <summary>
17+
/// <summary>
1818
/// Automation class that manages the transform of EF entities into POCO entities.
1919
/// </summary>
2020
public static class EntityTransformAutomation

src/DataSqlEF/CodeFactory.Automation.Data.Sql.EF.Logic/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@
3434
// by using the '*' as shown below:
3535
// [assembly: AssemblyVersion("1.0.*")]
3636
[assembly: AssemblyVersion("2.0.0.0")]
37-
[assembly: AssemblyFileVersion("2.23163.0.1")]
37+
[assembly: AssemblyFileVersion("2.23165.0.1")]
3838
[assembly: AssemblyCFEnvironment("CFVSW")]
3939
[assembly: AssemblyCFSdkVersion("2.23160.0.1")]

src/DataSqlEF/CodeFactory.Automation.Data.Sql.EF.Logic/RepositoryAutomation.cs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
using System.Text;
1313
using System.Threading.Tasks;
1414
using CodeFactory.Automation.Standard.NDF.Logic;
15-
15+
using Microsoft.Extensions.Logging;
1616

1717
namespace CodeFactory.Automation.Data.Sql.EF.Logic
1818
{
19-
/// <summary>
19+
/// <summary>
2020
/// Automation logic to create or update a data repository that supports a target entity hosted in Entity Framework.
2121
/// </summary>
2222
public static class RepositoryAutomation
@@ -32,6 +32,8 @@ public static class RepositoryAutomation
3232
/// <param name="contractProject">Project the contract will be added to.</param>
3333
/// <param name="contractFolder">Optional, project folder contracts will be stored in, default is null.</param>
3434
/// <param name="additionalContractNamespaces">Optional, additional namespaces to add to the contract definition, default is null.</param>
35+
/// <param name="loggerFieldName">Optional, the name of the logger field if logging is supported, default value is '_logger'</param>
36+
/// <param name="logLevel">Optional, the target logging level for logging messages, default value is Information.</param>
3537
/// <param name="repoProject">Repository project.</param>
3638
/// <param name="contextClass">EF context class for accessing entity framework.</param>
3739
/// <param name="useNDF">Optional, flag that determines if the NDF libraries are used, default true.</param>
@@ -43,7 +45,7 @@ public static class RepositoryAutomation
4345
public static async Task<CsClass> RefreshEFRepositoryAsync(this IVsActions source, CsClass efEntity, VsProject repoProject,
4446
VsProject contractProject, CsClass poco, CsClass contextClass, bool useNDF = true,bool supportLogging = true, VsProjectFolder repoFolder = null, VsProjectFolder contractFolder = null,
4547
string namePrefix = null, string nameSuffix = null,List<ManualUsingStatementNamespace> additionRepositoryNamespaces = null,
46-
List<ManualUsingStatementNamespace> additionalContractNamespaces = null)
48+
List<ManualUsingStatementNamespace> additionalContractNamespaces = null,string loggerFieldName = "_logger", LogLevel logLevel = LogLevel.Information)
4749
{
4850

4951
if (source == null)
@@ -188,13 +190,14 @@ private static async Task<CsInterface> CreateRepositoryContractAsync(this IVsAct
188190
/// <param name="supportLogging">Optional, flag that determines if logging is supported, default true.</param>
189191
/// <param name="repoFolder">Optional, project folder the repositories are stored in, default is null.</param>
190192
/// <param name="additionRepositoryNamespaces">Optional, list of additional namespaces to update the repository with.</param>
193+
/// <param name="loggerFieldName">Optional, name of the logger field if logging is supported, default is '_logger'</param>
191194
/// <param name="namePrefix">Optional, prefix to assign to the name of the repository, default is null.</param>
192195
/// <param name="nameSuffix">Optional, suffix to assign to the name of the repository, default is null.</param>
193196
/// <returns>Source for the created repository.</returns>
194197
/// <exception cref="CodeFactoryException">Raised if required data is missing to create the repository.</exception>
195198
private static async Task<CsSource> CreateEFRepositoryAsync(this IVsActions source, CsClass efEntity, VsProject repoProject,
196199
CsInterface repoContract, CsClass poco, CsClass contextClass, bool useNDF = true, bool supportLogging = true, VsProjectFolder repoFolder = null,
197-
string namePrefix = null, string nameSuffix = null, List<ManualUsingStatementNamespace> additionRepositoryNamespaces = null)
200+
string namePrefix = null, string nameSuffix = null, List<ManualUsingStatementNamespace> additionRepositoryNamespaces = null, string loggerFieldName = "_logger")
198201
{
199202
if (source == null)
200203
throw new CodeFactoryException("CodeFactory automation was not provided, cannot create the repository.");
@@ -266,7 +269,7 @@ private static async Task<CsSource> CreateEFRepositoryAsync(this IVsActions sour
266269
repoFormatter.AppendCodeLine(2, "/// <summary>");
267270
repoFormatter.AppendCodeLine(2, "/// Logger used by the repository.");
268271
repoFormatter.AppendCodeLine(2, "/// </summary>");
269-
repoFormatter.AppendCodeLine(2, "private readonly ILogger _logger;");
272+
repoFormatter.AppendCodeLine(2, $"private readonly ILogger {loggerFieldName};");
270273
repoFormatter.AppendCodeLine(2);
271274
repoFormatter.AppendCodeLine(2, "/// <summary>");
272275
repoFormatter.AppendCodeLine(2, "/// Creates a new instance of the repository.");
@@ -275,7 +278,7 @@ private static async Task<CsSource> CreateEFRepositoryAsync(this IVsActions sour
275278
repoFormatter.AppendCodeLine(2, "/// <param name=\"connection\">The connection information for the repository.</param>");
276279
repoFormatter.AppendCodeLine(2, $"public {repoName}(ILogger<{repoName}> logger, dataModel.IDBContextConnection<dataModel.{contextClass.Name}> connection)");
277280
repoFormatter.AppendCodeLine(2, "{");
278-
repoFormatter.AppendCodeLine(3, "_logger = logger;");
281+
repoFormatter.AppendCodeLine(3, $"{loggerFieldName} = logger;");
279282
repoFormatter.AppendCodeLine(3, "_connectionString = connection.ConnectionString;");
280283
repoFormatter.AppendCodeLine(2, "}");
281284
repoFormatter.AppendCodeLine(2);
@@ -304,11 +307,13 @@ private static async Task<CsSource> CreateEFRepositoryAsync(this IVsActions sour
304307
/// <param name="supportLogging">Optional, flag that determines if logging is supported, default true.</param>
305308
/// <param name="repoFolder">Optional, project folder the repositories are stored in, default is null.</param>
306309
/// <param name="additionRepositoryNamespaces">Optional, list of additional namespaces to update the repository with.</param>
310+
/// <param name="loggerFieldName">Optional, the name of the logger field if logging is supported, default value is '_logger'</param>
311+
/// <param name="logLevel">Optional, the target logging level for logging messages, default value is Information.</param>
307312
/// <returns></returns>
308313
/// <exception cref="CodeFactoryException"></exception>
309314
private static async Task<CsClass> UpdateEFRepositoryAsync(this IVsActions source, CsClass efEntity, VsProject repoProject,
310315
CsSource repoSource,CsInterface repoContract, CsClass poco, CsClass contextClass, bool useNDF = true, bool supportLogging = true, VsProjectFolder repoFolder = null,
311-
List<ManualUsingStatementNamespace> additionRepositoryNamespaces = null)
316+
List<ManualUsingStatementNamespace> additionRepositoryNamespaces = null,string loggerFieldName = "_logger", LogLevel logLevel = LogLevel.Information)
312317
{
313318
if (source == null)
314319
throw new CodeFactoryException("CodeFactory automation was not provided, cannot update the repository.");
@@ -355,8 +360,8 @@ private static async Task<CsClass> UpdateEFRepositoryAsync(this IVsActions sourc
355360

356361
if (supportLogging)
357362
{
358-
if (useNDF) logFormatter = new LoggerBlockNDF("_logger");
359-
else logFormatter = new LoggerBlockMicrosoft("_logger");
363+
if (useNDF) logFormatter = new LoggerBlockNDF(loggerFieldName);
364+
else logFormatter = new LoggerBlockMicrosoft(loggerFieldName);
360365
}
361366

362367
var boundCheckBlocks = new List<IBoundsCheckBlock>();
@@ -419,7 +424,7 @@ private static async Task<CsClass> UpdateEFRepositoryAsync(this IVsActions sourc
419424
injectFormatter.AppendCodeLine(0, "}");
420425

421426
string syntax = injectFormatter.ReturnSource();
422-
await methodBuilder.InjectMethodAsync(missingMethod, repoManager, 2, syntax: syntax);
427+
await methodBuilder.InjectMethodAsync(missingMethod, repoManager, 2, syntax: syntax,defaultLogLevel:logLevel);
423428

424429
injectFormatter.ResetFormatter();
425430
}

src/DataSqlEF/CodeFactory.Automation.Data.Sql.EF/CodeFactory.Automation.Data.Sql.EF.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</PropertyGroup>
3636
<ItemGroup>
3737
<PackageReference Include="CodeFactory.Automation.Standard.Logic">
38-
<Version>2.23159.1-PreRelease</Version>
38+
<Version>2.23165.1-PreRelease</Version>
3939
</PackageReference>
4040
<PackageReference Include="CodeFactory.WinVs.SDK" Version="2.23160.1-PreRelease" />
4141
<Reference Include="System" />

src/DataSqlEF/CodeFactory.Automation.Data.Sql.EF/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
// You can specify all the values or you can default the Build and Revision Numbers
3434
// by using the '*' as shown below:
3535
// [assembly: AssemblyVersion("1.0.*")]
36-
[assembly: AssemblyVersion("1.0.0.0")]
37-
[assembly: AssemblyFileVersion("1.0.0.0")]
36+
[assembly: AssemblyVersion("2.0.0.0")]
37+
[assembly: AssemblyFileVersion("2.23165.0.1")]
3838
[assembly: AssemblyCFEnvironment("CFVSW")]
3939
[assembly: AssemblyCFSdkVersion("2.23160.0.1")]

src/Standard/CodeFactory.Automation.Standard.Logic/AddMissingMembers.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using CodeFactory.WinVs;
1212
using CodeFactory.WinVs.Models.CSharp;
1313
using CodeFactory.WinVs.Models.CSharp.Builder;
14+
using Microsoft.Extensions.Logging;
1415

1516
namespace CodeFactory.Automation.Standard.Logic
1617
{
@@ -32,9 +33,11 @@ public static class AddMissingMembers
3233
/// <param name="updateClass">Class model to add missing members to.</param>
3334
/// <param name="supportsLogging">Flag that determines if logging is enabled.</param>
3435
/// <param name="loggerFieldName">Optional, the name of the field to use for logging.</param>
35-
/// <returns></returns>
36+
/// <param name="logLevel">Optional, the target log level to add to missing members, default is information.</param>
37+
/// <param name="tryBlock">Optional, try block to use when generating the missing method, default is null which will use the built in try block implementation.</param>
38+
/// <returns>Updated class with missing members added.</returns>
3639
public static async Task<CsClass> AddMissingMembersStandardAsync(this IVsActions source, CsSource sourceCode,
37-
CsClass updateClass, bool supportsLogging, string loggerFieldName = "_logger")
40+
CsClass updateClass, bool supportsLogging, string loggerFieldName = "_logger",LogLevel logLevel = LogLevel.Information, ITryBlock tryBlock = null)
3841
{
3942
//Bounds checks to make sure all data needed is provided.
4043
if (sourceCode == null)
@@ -73,12 +76,14 @@ public static async Task<CsClass> AddMissingMembersStandardAsync(this IVsActions
7376
new CatchBlockStandard(loggerBlock)
7477
};
7578

76-
ITryBlock tryBlock = new TryBlockStandard(loggerBlock, catchBlocks);
79+
ITryBlock methodTryBlock = tryBlock == null
80+
? new TryBlockStandard(loggerBlock, catchBlocks)
81+
: tryBlock;
7782

7883
if(supportsLogging) await manager.UsingStatementAddAsync(MicrosoftLoggingNamespace);
7984

8085
//Creating the builders to generate code by member type.
81-
IMethodBuilder methodBuilder = new MethodBuilderStandard(loggerBlock, boundsChecks, tryBlock);
86+
IMethodBuilder methodBuilder = new MethodBuilderStandard(loggerBlock, boundsChecks, methodTryBlock);
8287
IPropertyBuilder propertyBuilder = new PropertyBuilderStandard();
8388
IEventBuilder eventBuilder = new EventBuilderStandard();
8489

@@ -88,7 +93,7 @@ public static async Task<CsClass> AddMissingMembersStandardAsync(this IVsActions
8893

8994
foreach (var missingProperty in missingProperties)
9095
{
91-
var propertySyntax = await propertyBuilder.BuildPropertyAsync(missingProperty, manager, 2);
96+
var propertySyntax = await propertyBuilder.BuildPropertyAsync(missingProperty, manager, 2,defaultLogLevel:logLevel);
9297

9398
if(propertySyntax == null) continue;
9499

@@ -102,7 +107,7 @@ public static async Task<CsClass> AddMissingMembersStandardAsync(this IVsActions
102107

103108
foreach (var missingMethod in missingMethods)
104109
{
105-
var methodSyntax = await methodBuilder.BuildMethodAsync(missingMethod, manager, 2);
110+
var methodSyntax = await methodBuilder.BuildMethodAsync(missingMethod, manager, 2,defaultLogLevel:logLevel);
106111

107112
if(methodSyntax == null) continue;
108113

src/Standard/CodeFactory.Automation.Standard.Logic/CodeFactory.Automation.Standard.Logic.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<WarningLevel>4</WarningLevel>
3636
</PropertyGroup>
3737
<ItemGroup>
38-
<PackageReference Include="CodeFactory.WinVs.SDK" Version="2.23158.1-PreRelease" />
38+
<PackageReference Include="CodeFactory.WinVs.SDK" Version="2.23160.1-PreRelease" />
3939
<Reference Include="System" />
4040
<Reference Include="System.Core" />
4141
<Reference Include="System.Xml.Linq" />

src/Standard/CodeFactory.Automation.Standard.Logic/CodeFactory.Automation.Standard.nuspec

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" >
33
<metadata>
44
<id>CodeFactory.Automation.Standard.Logic</id>
5-
<version>2.23159.1-PreRelease</version>
5+
<version>2.23165.1-PreRelease</version>
66
<title>Standard automation logic to be used with CodeFactory Commands.</title>
77
<authors>CodeFactory, LLC.</authors>
88
<owners>CodeFactory, LLC.</owners>
@@ -13,15 +13,18 @@
1313
<repository type="git" url="https://github.com/CodeFactoryLLC/CodeFactoryPackages.git" branch="main" commit="019e2b9094f05bea10c1f4e99a79d4673e5c0da9" />
1414
<releaseNotes>
1515
Notes
16-
Initial Release
17-
18-
Automation Support:
16+
17+
Updates:
1918
- Add Missing interface members.
19+
- Added loglLevel optional prameter sets logging level when logging in methods and properties.
20+
- added tryBlock optional parameter that sets the try,catch,finally logic for methods. If not provided will use the default built in logic.
21+
- POCOAutomation
22+
- Fixed type check logic error.
2023
</releaseNotes>
2124
<copyright>Copyright © 2023 CodeFactory, LLC.</copyright>
2225
<tags>Factory Automation</tags>
2326
<dependencies>
24-
<dependency id="CodeFactory.WinVs.SDK" version="2.23158.1-PreRelease"/>
27+
<dependency id="CodeFactory.WinVs.SDK" version="2.23160.1-PreRelease"/>
2528
</dependencies>
2629
<icon>CFLogo128.png</icon>
2730
</metadata>

0 commit comments

Comments
 (0)