Skip to content

Commit

Permalink
checking in version 5.1.1, which fixes the DataManager must be passed…
Browse files Browse the repository at this point in the history
… in from the Gateway
  • Loading branch information
DataJuggler committed Jan 15, 2025
1 parent da9b287 commit 2a1f004
Show file tree
Hide file tree
Showing 29 changed files with 344 additions and 161 deletions.
24 changes: 12 additions & 12 deletions DataTier.Net/Client/Builders/ControllerCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ private void WriteDeleteMethod(DataTable dataTable)
string parameterName = "temp" + dataType;

// BeginRegion #region Delete(<DataType> dataType>
BeginRegion("Delete(" + dataType + " " + parameterName + ", DataManager dataManager = null)");
BeginRegion("Delete(" + dataType + " " + parameterName + ", DataManager dataManager)");

// Write Summary
WriteLine("/// <summary>");
Expand All @@ -380,7 +380,7 @@ private void WriteDeleteMethod(DataTable dataTable)
WriteLine("/// <returns>True if the delete is successful or false if not.</returns>");

// Get classDeclaration
string classDeclaration = "public static bool Delete(" + dataType + " " + parameterName + ", DataManager dataManager = null)";
string classDeclaration = "public static bool Delete(" + dataType + " " + parameterName + ", DataManager dataManager)";

// Write classDeclaration
WriteLine(classDeclaration);
Expand Down Expand Up @@ -559,7 +559,7 @@ private void WriteFetchAllMethod(DataTable dataTable)
string delegateMethodName = "fetchAllMethod";

// BeginRegion FetchAll
BeginRegion("FetchAll(" + dataType + " " + parameterName + ", DataManager dataManager = null)");
BeginRegion("FetchAll(" + dataType + " " + parameterName + ", DataManager dataManager)");

// set to procedure
string query = "procedure";
Expand All @@ -575,7 +575,7 @@ private void WriteFetchAllMethod(DataTable dataTable)
WriteLine("/// <returns>A collection of '" + dataType + "' objects.</returns>");

// Get classDeclaration
string classDeclaration = "public static " + collectionDataType + " FetchAll(" + dataType + " " + parameterName + ", DataManager dataManager = null)";
string classDeclaration = "public static " + collectionDataType + " FetchAll(" + dataType + " " + parameterName + ", DataManager dataManager)";

// Write classDeclaration
WriteLine(classDeclaration);
Expand Down Expand Up @@ -726,7 +726,7 @@ private void WriteFindMethod(DataTable dataTable)
string delegateMethodName = "findMethod";

// BeginRegion #region Find(
BeginRegion("Find(" + dataType + " temp" + dataType + ", DataManager dataManager = null)");
BeginRegion("Find(" + dataType + " temp" + dataType + ", DataManager dataManager)");

// Write Summary
WriteLine("/// <summary>");
Expand All @@ -742,7 +742,7 @@ private void WriteFindMethod(DataTable dataTable)
WriteLine("/// <returns>A '" + dataType + "' object if found else a null '" + dataType + "'.</returns>");

// Get classDeclaration
string classDeclaration = "public static " + dataType + " Find(" + dataType + " " + parameterName + ", DataManager dataManager = null)";
string classDeclaration = "public static " + dataType + " Find(" + dataType + " " + parameterName + ", DataManager dataManager)";

// Write classDeclaration
WriteLine(classDeclaration);
Expand Down Expand Up @@ -907,7 +907,7 @@ private void WriteInsertMethodIdentity(DataTable dataTable)
string parameterName = CapitalizeFirstChar(dataType, true);

// BeginRegion #region Find(
BeginRegion("Insert(" + dataType + " " + parameterName + ", DataManager dataManager = null)");
BeginRegion("Insert(" + dataType + " " + parameterName + ", DataManager dataManager)");

// Write Summary
WriteLine("/// <summary>");
Expand All @@ -926,7 +926,7 @@ private void WriteInsertMethodIdentity(DataTable dataTable)
WriteLine("/// <returns>The id (int) of the new '" + dataType + "' object that was inserted.</returns>");

// Get classDeclaration
string classDeclaration = "public static int Insert(" + dataType + " " + parameterName + ", DataManager dataManager = null)";
string classDeclaration = "public static int Insert(" + dataType + " " + parameterName + ", DataManager dataManager)";

// Write classDeclaration
WriteLine(classDeclaration);
Expand Down Expand Up @@ -1338,7 +1338,7 @@ private void WriteSaveMethod(DataTable dataTable)
string parameterName = CapitalizeFirstChar(dataType, true);

// BeginRegion #region Find(
BeginRegion("Save(ref " + dataType + " " + parameterName + ", DataManager dataManager = null)");
BeginRegion("Save(ref " + dataType + " " + parameterName + ", DataManager dataManager)");

// Write Summary
WriteLine("/// <summary>");
Expand All @@ -1350,7 +1350,7 @@ private void WriteSaveMethod(DataTable dataTable)
WriteLine("/// <returns>True if successful or false if not.</returns>");

// Get classDeclaration
string classDeclaration = "public static bool Save(ref " + dataType + " " + parameterName + ", DataManager dataManager = null)";
string classDeclaration = "public static bool Save(ref " + dataType + " " + parameterName + ", DataManager dataManager)";

// Write classDeclaration
WriteLine(classDeclaration);
Expand Down Expand Up @@ -1548,7 +1548,7 @@ private void WriteUpdateMethod(DataTable dataTable)
string parameterName = CapitalizeFirstChar(dataType, true);

// BeginRegion #region Find(
BeginRegion("Update(" + dataType + " " + parameterName + ", DataManager dataManager = null)");
BeginRegion("Update(" + dataType + " " + parameterName + ", DataManager dataManager)");

// Write Summary
WriteLine("/// <summary>");
Expand All @@ -1567,7 +1567,7 @@ private void WriteUpdateMethod(DataTable dataTable)
WriteLine("/// <returns>True if successful else false if not.</returns>");

// Get classDeclaration
string classDeclaration = "public static bool Update(" + dataType + " " + CapitalizeFirstChar(dataType, true) + ", DataManager dataManager = null)";
string classDeclaration = "public static bool Update(" + dataType + " " + CapitalizeFirstChar(dataType, true) + ", DataManager dataManager)";

// Write classDeclaration
WriteLine(classDeclaration);
Expand Down
36 changes: 18 additions & 18 deletions DataTier.Net/Client/Builders/GatewayCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public class GatewayCreator : CSharpClassWriter
public GatewayCreator(List<DataTable> dataTablesArg, ReferencesSet objectReferencesArg, string gatewayPathArg, string projectNameArg, string nameSpaceNameArg, ProjectFileManager fileManager, TargetFrameworkEnum targetFramework) : base(fileManager, false, false, targetFramework)
{
// Set Properties
this.DataTables = dataTablesArg;
this.ProjectName = projectNameArg;
this.NameSpaceName = nameSpaceNameArg;
this.GatewayPath = gatewayPathArg;
this.ObjectReferences = objectReferencesArg;
DataTables = dataTablesArg;
ProjectName = projectNameArg;
NameSpaceName = nameSpaceNameArg;
GatewayPath = gatewayPathArg;
ObjectReferences = objectReferencesArg;
}
#endregion

Expand All @@ -59,7 +59,7 @@ public GatewayCreator(List<DataTable> dataTablesArg, ReferencesSet objectReferen
internal void CreateGatewayMethods()
{
// if the GatewayPath exists
if ((this.HasGatewayPath) && (File.Exists(GatewayPath)) && (DataTables != null) && (DataTables.Count > 0))
if ((HasGatewayPath) && (File.Exists(GatewayPath)) && (DataTables != null) && (DataTables.Count > 0))
{
// set the text of the existing Gateway
string gatewayText = File.ReadAllText(GatewayPath);
Expand Down Expand Up @@ -109,15 +109,15 @@ internal void CreateGatewayMethods()
else
{
// if the DataTables do not exist
if (this.DataTables == null)
if (DataTables == null)
{
// raise an exception so the build fails
throw new Exception("The DataTables collection does not exist.");
}
else
{
// raise an exception so the build fails
throw new Exception("The gateway file '" + this.GatewayPath + "' could not be found.");
throw new Exception("The gateway file '" + GatewayPath + "' could not be found.");
}
}
}
Expand Down Expand Up @@ -357,7 +357,7 @@ private void WriteDeleteMethod(DataTable dataTable, List<TextLine> lines)
TextLine initialValue = new TextLine(" bool deleted = false;");
TextLine blankLine = new TextLine(" ");
TextLine validationTestComment = new TextLine(" // if the AppController exists");
TextLine validationTest = new TextLine(" if (this.HasAppController)");
TextLine validationTest = new TextLine(" if (HasAppController)");
TextLine openBracket2 = new TextLine(" {");
TextLine openBracket3 = new TextLine(" {");
TextLine returnValueComment = new TextLine(" // return value");
Expand All @@ -375,7 +375,7 @@ private void WriteDeleteMethod(DataTable dataTable, List<TextLine> lines)
TextLine setPrimaryKeyComment = new TextLine(" // set the primary key");
TextLine setPrimaryKey = new TextLine(" temp" + dataTable.ClassName + ".UpdateIdentity(" + variableName + ");");
TextLine performDeleteComment = new TextLine(" // perform the delete");
TextLine performDelete = new TextLine(" deleted = " + dataTable.Name + "Controller.Delete(temp" + dataTable.ClassName + ");");
TextLine performDelete = new TextLine(" deleted = " + dataTable.Name + "Controller.Delete(temp" + dataTable.ClassName + ", DataManager);");

// if this is an integer or an Identity column
if ((dataTable.PrimaryKey.DataType == DataManager.DataTypeEnum.Autonumber) || (dataTable.PrimaryKey.DataType == DataManager.DataTypeEnum.Integer))
Expand Down Expand Up @@ -662,7 +662,7 @@ private void WriteFindMethod(DataTable dataTable, List<TextLine> lines)
TextLine initialValue = new TextLine(" " + dataTable.ClassName + " " + objectName + " = null;");
TextLine blankLine = new TextLine();
TextLine validationTestComment = new TextLine(" // if the AppController exists");
TextLine validationTest = new TextLine(" if (this.HasAppController)");
TextLine validationTest = new TextLine(" if (HasAppController)");
TextLine openBracket2 = new TextLine(" {");
TextLine closeBracket = new TextLine(" }");
TextLine closeBracket2 = new TextLine(" }");
Expand All @@ -678,7 +678,7 @@ private void WriteFindMethod(DataTable dataTable, List<TextLine> lines)
TextLine setPrimaryKeyComment = new TextLine(" // set the primary key");
TextLine setPrimaryKey = new TextLine(" temp" + dataTable.ClassName + ".UpdateIdentity(" + variableName + ");");
TextLine performFindComment = new TextLine(" // perform the find");
TextLine performFind = new TextLine(" " + objectName + " = " + dataTable.Name + "Controller.Find(temp" + dataTable.ClassName + ");");
TextLine performFind = new TextLine(" " + objectName + " = " + dataTable.Name + "Controller.Find(temp" + dataTable.ClassName + ", DataManager);");
TextLine returnValueComment = new TextLine(" // return value");
TextLine returnValue = new TextLine(" return " + objectName + ";");

Expand Down Expand Up @@ -1027,7 +1027,7 @@ private void WriteGatewayFile(List<TextLine> lines)
string documentText = sb.ToString();

// append all the text to the file
File.AppendAllText(this.GatewayPath, documentText);
File.AppendAllText(GatewayPath, documentText);
}
}
#endregion
Expand Down Expand Up @@ -1065,13 +1065,13 @@ private void WriteLoadMethod(DataTable dataTable, List<TextLine> lines)
TextLine initialValue = new TextLine(" List<" + dataTable.ClassName + "> " + collectionName + " = null;");
TextLine blankLine = new TextLine();
TextLine validationTestComment = new TextLine(" // if the AppController exists");
TextLine validationTest = new TextLine(" if (this.HasAppController)");
TextLine validationTest = new TextLine(" if (HasAppController)");
TextLine openBracket2 = new TextLine(" {");
TextLine closeBracket = new TextLine(" }");
TextLine closeBracket2 = new TextLine(" }");
TextLine endRegion = new TextLine(" #endregion");
TextLine performLoadComment = new TextLine(" // perform the load");
TextLine performLoad = new TextLine(" " + collectionName + " = " + dataTable.Name + "Controller.FetchAll(temp" + dataTable.ClassName + ");");
TextLine performLoad = new TextLine(" " + collectionName + " = " + dataTable.Name + "Controller.FetchAll(temp" + dataTable.ClassName + ", DataManager);");
TextLine returnValueComment = new TextLine(" // return value");
TextLine returnValue = new TextLine(" return " + collectionName + ";");

Expand Down Expand Up @@ -1249,15 +1249,15 @@ private void WriteSaveMethod(DataTable dataTable, List<TextLine> lines)
TextLine initialValue = new TextLine(" bool saved = false;");
TextLine blankLine = new TextLine();
TextLine validationTestComment = new TextLine(" // if the AppController exists");
TextLine validationTest = new TextLine(" if (this.HasAppController)");
TextLine validationTest = new TextLine(" if (HasAppController)");
TextLine openBracket2 = new TextLine(" {");
TextLine closeBracket = new TextLine(" }");
TextLine closeBracket2 = new TextLine(" }");
TextLine openBracket3 = new TextLine(" {");
TextLine closeBracket3 = new TextLine(" }");
TextLine endRegion = new TextLine(" #endregion");
TextLine performSaveComment = new TextLine(" // perform the save");
TextLine performSave = new TextLine(" saved = " + dataTable.Name + "Controller.Save(ref " + objectName + ");");
TextLine performSave = new TextLine(" saved = " + dataTable.Name + "Controller.Save(ref " + objectName + ", DataManager);");
TextLine returnValueComment = new TextLine(" // return value");
TextLine returnValue = new TextLine(" return saved;");

Expand Down Expand Up @@ -1435,7 +1435,7 @@ public bool HasGatewayPath
get
{
// initial value
bool hasGatewayPath = (!String.IsNullOrEmpty(this.GatewayPath));
bool hasGatewayPath = (!String.IsNullOrEmpty(GatewayPath));

// return value
return hasGatewayPath;
Expand Down
Loading

0 comments on commit 2a1f004

Please sign in to comment.