Skip to content

Commit 7a8e37d

Browse files
committed
Bug fix for POCOAutomation
1 parent 6c82252 commit 7a8e37d

File tree

3 files changed

+22
-18
lines changed

3 files changed

+22
-18
lines changed

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

Lines changed: 3 additions & 1 deletion
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.23164.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>
@@ -18,6 +18,8 @@
1818
- Add Missing interface members.
1919
- Added loglLevel optional prameter sets logging level when logging in methods and properties.
2020
- 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.
2123
</releaseNotes>
2224
<copyright>Copyright © 2023 CodeFactory, LLC.</copyright>
2325
<tags>Factory Automation</tags>

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

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,13 @@ private static async Task<CsClass> UpdatePOCOAsync(this IVsActions source, CsCla
284284

285285
if (targetPocoModel == null)
286286
{
287-
var sourceModelClass = propertyToAdd.PropertyType.GetClassModel();
287+
var sourceModelClass = propertyToAdd.PropertyType.GetClassModel() ?? throw new CodeFactoryException(
288+
$"Could not load the data model '{propertyToAdd.PropertyType.Name}' could not refresh the poco model, cannot update the POCO class '{pocoClass.Name}'.");
288289

289-
if (sourceModelClass == null)
290-
throw new CodeFactoryException(
291-
$"Could not the data model '{propertyToAdd.PropertyType.Name}' could not refresh the poco model, cannot update the POCO class '{pocoClass.Name}'.");
290+
if (sourceModelClass.IsLoaded == false) throw new CodeFactoryException($"Could not load the data model '{propertyToAdd.PropertyType.Name}' could not refresh the poco model, cannot update the POCO class '{pocoClass.Name}'.");
292291

293292
await source.RefreshPOCOAsync(sourceModelClass, pocoProject, defaultNamespaces, pocoFolder,
294-
pocoSummary, convertNullableTypes);
293+
$"POCO data class that supports '{sourceModelClass.Name}'", convertNullableTypes);
295294
}
296295
}
297296
}
@@ -301,21 +300,24 @@ await source.RefreshPOCOAsync(sourceModelClass, pocoProject, defaultNamespaces,
301300
//Checking to make sure other source class objects used by the poco also have poco's created.
302301
foreach (var propGenericType in propertyToAdd.PropertyType.GenericTypes)
303302
{
304-
if (propGenericType.Name != sourceClass.Name)
303+
//Checking to make sure other source class objects used by the poco also have poco's created.
304+
if (propGenericType.TypeInTargetNamespace(sourceClass.Namespace))
305305
{
306-
var targetPocoModel =
307-
await pocoProject.FindCSharpSourceByClassNameAsync(propGenericType.Name);
308-
309-
if (targetPocoModel == null)
306+
if (propGenericType.Name != sourceClass.Name)
310307
{
311-
var sourceModelClass = propGenericType.GetClassModel();
308+
var targetPocoModel =
309+
await pocoProject.FindCSharpSourceByClassNameAsync(propGenericType.Name);
310+
311+
if (targetPocoModel == null)
312+
{
313+
var sourceModelClass = propGenericType.GetClassModel() ?? throw new CodeFactoryException(
314+
$"Could not load the data model '{propertyToAdd.PropertyType.Name}' could not refresh the poco model, cannot update the POCO class '{pocoClass.Name}'.");
312315

313-
if (sourceModelClass == null)
314-
throw new CodeFactoryException(
315-
$"Could not the data model '{propGenericType.Name}' could not refresh the poco model, cannot update the POCO class '{pocoClass.Name}'.");
316+
if (sourceModelClass.IsLoaded == false) throw new CodeFactoryException($"Could not load the data model '{propertyToAdd.PropertyType.Name}' could not refresh the poco model, cannot update the POCO class '{pocoClass.Name}'.");
316317

317-
await source.RefreshPOCOAsync(sourceModelClass, pocoProject, defaultNamespaces,
318-
pocoFolder, pocoSummary, convertNullableTypes);
318+
await source.RefreshPOCOAsync(sourceModelClass, pocoProject, defaultNamespaces, pocoFolder,
319+
$"POCO data class that supports '{sourceModelClass.Name}'", convertNullableTypes);
320+
}
319321
}
320322
}
321323
}

src/Standard/CodeFactory.Automation.Standard.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("1.0.0.0")]
37-
[assembly: AssemblyFileVersion("2.23164.0.1")]
37+
[assembly: AssemblyFileVersion("2.23165.0.1")]
3838
[assembly: AssemblyCFEnvironment("CFVSW")]
3939
[assembly: AssemblyCFSdkVersion("2.23160.0.1")]

0 commit comments

Comments
 (0)