BusinessMgr 3.0.1.9 Interfaces data model

This commit is contained in:
Andy Howard
2025-10-30 12:58:43 +00:00
parent 86b22db88b
commit e3cb2b26fe
35 changed files with 1355 additions and 1128 deletions
+1 -5
View File
@@ -3,8 +3,6 @@ using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Routing;
using Microsoft.Net.Http.Headers;
using Newtonsoft.Json;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
@@ -16,8 +14,6 @@ using System.Collections.Specialized;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web;
namespace Sacs.Web.Components
@@ -43,7 +39,7 @@ namespace Sacs.Web.Components
//-------------------------------------------------------------------
// Properties.
public DateTime CreatedAt { get; } = DateTime.Now;
public bool DebugMode { get; } = SacsSystem.DebugMode;
public static bool DebugMode { get; } = SacsSystem.DebugMode;
/// <summary>
/// Indicate whether session data should be stored by action.
/// <para>Any action that might modify the session data must store it.</para>
+5 -6
View File
@@ -1,5 +1,4 @@
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
@@ -18,16 +17,16 @@ namespace Sarand.Net.Standard.Base.Bus
//-------------------------------------------------------------------
// Construction.
public ItemId() { }
public ItemId(short itemType, SysId id, String caption = "")
public ItemId(short? itemType, SysId id, String caption = "")
{
Type = itemType;
Type = itemType ?? 0;
Id = SysId.InvalidOnNull(id);
idType = ItemIdType.SysId;
Caption = StringUtil.EmptyOnNull(caption);
}
public ItemId(short itemType, String stringId, String caption = "")
public ItemId(short? itemType, String stringId, String caption = "")
{
Type = itemType;
Type = itemType ?? 0;
StringId = StringUtil.EmptyOnNull(stringId);
idType = ItemIdType.String;
Caption = StringUtil.EmptyOnNull(caption);
@@ -1,11 +1,10 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Sarand.Net.Standard.Base.Bus
{
@@ -424,16 +423,16 @@ namespace Sarand.Net.Standard.Base.Bus
//-------------------------------------------------------------------
// Update stamps.
public UpdateStamp CreateStamp { get { return data.CreateStamp; } }
public void SetCreateStamp(DateTime on, SysId by, String host)
public void SetCreateStamp(DateTime? on, SysId by, String host)
{
CreateStamp.On = on;
CreateStamp.On = on ?? default(DateTime);
CreateStamp.By = by;
CreateStamp.Host = host;
}
public UpdateStamp UpdateStamp { get { return data.UpdateStamp; } }
public void SetUpdateStamp(DateTime on, SysId by, String host)
public void SetUpdateStamp(DateTime? on, SysId by, String host)
{
UpdateStamp.On = on;
UpdateStamp.On = on ?? default(DateTime);
UpdateStamp.By = by;
UpdateStamp.Host = host;
}
+11 -9
View File
@@ -1,14 +1,12 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace Sarand.Net.Standard.Base.Bus
{
@@ -24,9 +22,13 @@ namespace Sarand.Net.Standard.Base.Bus
//-------------------------------------------------------------------
// Construction.
public SysId() { }
public SysId(Int64 id)
public SysId(Int64? id)
{
this.id = id;
this.id = id ?? 0;
}
public SysId(Int32? id)
{
this.id = id ?? 0;
}
//-------------------------------------------------------------------
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:21
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:12
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Base.CodeTypes
{
@@ -65,7 +65,7 @@ namespace Sarand.Net.Standard.Base.CodeTypes
public static ulong MaxTextLen { get; private set; }
//-------------------------------------------------------------------
// Retrieve Table details (eg. name: 'Company').
// Retrieve Table details.
public static int GetTableCount ()
{
return tableCount;
@@ -123,8 +123,7 @@ namespace Sarand.Net.Standard.Base.CodeTypes
String tableName = StringUtil.EmptyOnNull(tableAlias);
if (tableName.IsEmpty()) tableName = GetTableName(GetTableForColumn(column));
columnName = tableName + (tableName.Length > 0 ? "." : "") + columnName;
if (braces)
columnName = "(" + columnName + ")";
if (braces) columnName = $"({columnName})";
}
return columnName;
}
@@ -157,11 +156,11 @@ namespace Sarand.Net.Standard.Base.CodeTypes
case DbReservedWordDelim.None:
break;
case DbReservedWordDelim.DoubleQuotes:
word = "\"" + word + "\"";
word = $"\"{word}\"";
break;
case DbReservedWordDelim.SquareBrackets:
default:
word = "[" + word + "]";
word = $"[{word}]";
break;
}
return word;
@@ -376,7 +375,7 @@ namespace Sarand.Net.Standard.Base.CodeTypes
"VALUES",
"VIEW",
"WHEN",
"WHERE",
"WHERE"
};
//-------------------------------------------------------------------
+10 -4
View File
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
namespace Sarand.Net.Standard.Base.Core
{
@@ -250,7 +250,7 @@ namespace Sarand.Net.Standard.Base.Core
if (dataType == DataType.Decimal)
{
SaLogger.Warn($"{SysUtil.Fn} Data type: {dataType.ToString()}.");
return (double)(decimal)value;
return Convert.ToDouble((decimal)value);
}
if (SacsSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn} Incorrect data type: {dataType.ToString()}.");
return 0.0;
@@ -259,6 +259,12 @@ namespace Sarand.Net.Standard.Base.Core
{
if (dataType == DataType.Decimal) return (decimal)value;
if (dataType == DataType.Unknown) return 0.00m;
// Aug-2018 Temporarily allow decimal values to be returned as double.
if (dataType == DataType.Double)
{
SaLogger.Warn($"{SysUtil.Fn} Data type: {dataType.ToString()}.");
return Convert.ToDecimal((double)value);
}
if (SacsSystem.DebugMode) SaLogger.Debug($"{SysUtil.Fn} Incorrect data type: {dataType.ToString()}.");
return 0.00m;
}
+15 -3
View File
@@ -1,8 +1,7 @@
using System;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
namespace Sarand.Net.Standard.Base.Dbas
{
@@ -48,6 +47,18 @@ namespace Sarand.Net.Standard.Base.Dbas
return (this.Name.EqualsCI(name));
}
//-------------------------------------------------------------------
// Utilities.
public void ChangeTableName(String newName)
{
this.Name = newName;
foreach (DbDfnColumn columnDfn in Columns)
columnDfn.Table = newName;
foreach (DbDfnIndex indexDfn in Indices)
indexDfn.Table = newName;
}
//-------------------------------------------------------------------
// Columns.
public bool HasColumnByName(String columnName)
@@ -157,6 +168,7 @@ namespace Sarand.Net.Standard.Base.Dbas
//-------------------------------------------------------------------
}
//=======================================================================
// Table list extensions.
public static class DbDfnTableList
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
namespace Sarand.Net.Standard.Base.Interfaces
{
@@ -161,6 +161,13 @@ namespace Sarand.Net.Standard.Base.Interfaces
return Core.DataValue.TriStateType.Unknown;
}
//-------------------------------------------------------------------
// Utilities.
public ItemId GetItemId()
{
return new ItemId((short)SaDataItemType.Interface, Id);
}
//-------------------------------------------------------------------
// Properties.
public Data GetData() { return data.Clone(); }
@@ -230,6 +237,7 @@ namespace Sarand.Net.Standard.Base.Interfaces
public String Context { get; set; }
public SaInterfaceCategory InterfaceCategory { get; set; } = SaInterfaceCategory.Unknown;
public HashSet<short> InterfaceTypesIncluded { get; } = new HashSet<short>();
public String Search { get; set; }
/// <summary>Exact code match</summary>
public String Code { get; set; }
public String CaptionPartial { get; set; }
@@ -153,6 +153,7 @@ namespace Sarand.Net.Standard.Base.Interfaces
public abstract bool CanRemoveInterface(SaInterface interfaceObj);
// Interface management.
public abstract SysId CreateInterface(String context, SaInterfaceCategory interfaceCategory, short interfaceType, String code, String caption, DbUpdateInfo dbUpdateInfo);
public abstract bool UpdateInterface(SaInterface interfaceObj, DbUpdateInfo dbUpdateInfo);
// Associated events.
public abstract void OnInterfaceCreated(SysId interfaceId);
public abstract void OnInterfaceUpdated(SysId interfaceId);
@@ -167,7 +168,11 @@ namespace Sarand.Net.Standard.Base.Interfaces
// Retrieve interfaces.
public abstract SaInterface GetInterfaceById(SysId interfaceId);
public abstract SaInterface GetInterface(SaInterface.Params prmInterface);
public abstract ColumnDfn GetInterfaceColumnDfn(SaInterface.Column columnId, string caption = "", int width = 0);
public abstract long GetInterfaceCount(SaInterface.Params prmInterface);
public abstract List<SaInterface> GetInterfaceList(SaInterface.Params prmInterface);
public abstract DbResultSet ExecuteInterfaceQuery(List<ColumnDfn> columns, SaInterface.Params prm);
public abstract DataValue GetInterfaceDataValue(ColumnDfn column, NamedValue.Map values);
//---------------------------------------------------------------
// Conversion between Interface Category & Code and the equivalent database Id.
public abstract SysId GetInterfaceIdForContextCategoryType(String context, SaInterfaceCategory interfaceCategory, short interfaceType);
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
namespace Sarand.Net.Standard.Base.Interfaces
{
@@ -57,10 +57,10 @@ namespace Sarand.Net.Standard.Base.Interfaces
public String ExternalReference { get; set; } = String.Empty;
public SaStatus ProcessStatus { get; set; } = SaStatus.Unknown;
public SysId ProcessStatusBy { get; set; } = null;
public DateTime ProcessStatusAt { get; set; } = DateTime.MinValue;
public DateTime? ProcessStatusAt { get; set; } = DateTime.MinValue;
public SaStatus ItemStatus { get; set; } = SaStatus.Unknown;
public SysId ItemStatusBy { get; set; } = null;
public DateTime ItemStatusAt { get; set; } = DateTime.MinValue;
public DateTime? ItemStatusAt { get; set; } = DateTime.MinValue;
}
//-------------------------------------------------------------------
@@ -106,10 +106,10 @@ namespace Sarand.Net.Standard.Base.Interfaces
get { return data.ProcessStatusBy; }
set { CheckChanged(data.ProcessStatusBy, value); data.ProcessStatusBy = value; }
}
public DateTime ProcessStatusAt
public DateTime? ProcessStatusAt
{
get { return data.ProcessStatusAt; }
set { CheckChanged(data.ProcessStatusAt, value); data.ProcessStatusAt = value; }
set { CheckChangedNullable(data.ProcessStatusAt, value); data.ProcessStatusAt = value; }
}
public SaStatus ItemStatus
{
@@ -121,10 +121,10 @@ namespace Sarand.Net.Standard.Base.Interfaces
get { return data.ItemStatusBy; }
set { CheckChanged(data.ItemStatusBy, value); data.ItemStatusBy = value; }
}
public DateTime ItemStatusAt
public DateTime? ItemStatusAt
{
get { return data.ItemStatusAt; }
set { CheckChanged(data.ItemStatusAt, value); data.ItemStatusAt = value; }
set { CheckChangedNullable(data.ItemStatusAt, value); data.ItemStatusAt = value; }
}
// Population.
internal void PopulateFrom(Data data)
@@ -299,7 +299,7 @@ namespace Sarand.Net.Standard.Base.Interfaces
get { return data.ProcessStatusBy; }
set { data.ProcessStatusBy = value; }
}
public DateTime ProcessStatusAt
public DateTime? ProcessStatusAt
{
get { return data.ProcessStatusAt; }
set { data.ProcessStatusAt = value; }
@@ -314,7 +314,7 @@ namespace Sarand.Net.Standard.Base.Interfaces
get { return data.ItemStatusBy; }
set { data.ItemStatusBy = value; }
}
public DateTime ItemStatusAt
public DateTime? ItemStatusAt
{
get { return data.ItemStatusAt; }
set { data.ItemStatusAt = value; }
@@ -1,3 +1,4 @@
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
using System;
@@ -5,7 +6,7 @@ using System.Collections.Generic;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:58
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:13
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Base.Interfaces
{
@@ -113,22 +114,39 @@ namespace Sarand.Net.Standard.Base.Interfaces
// Data members.
private static readonly int tableCount = 5;
private static readonly int columnCount = 79;
private static ulong maxTextLen = 0;
public static ulong MaxTextLen { get; private set; }
//-------------------------------------------------------------------
// Retrieve Table details (eg. name: 'Company').
// Retrieve Table details.
public static int GetTableCount ()
{
return tableCount;
}
public static String GetSchemaName (TableIdx table, bool delimitReservedWords = true)
{
int tableIdx = (int)table - 1;
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
String schemaName = tables[(int)tableIdx].Schema;
if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); }
return schemaName;
}
public static String GetTableName (TableIdx table, bool delimitReservedWords = true)
{
int tableIdx = (int)table - 1;
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
String tableName = tables[(int)tableIdx];
String tableName = tables[(int)tableIdx].Name;
if (delimitReservedWords) tableName = DelimitReservedWord(tableName);
return tableName;
}
public static String GetTableNameQual (TableIdx table, bool delimitReservedWords = true)
{
int tableIdx = (int)table - 1;
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
String schemaName = tables[(int)tableIdx].Schema;
String tableName = tables[(int)tableIdx].Name;
if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); tableName = DelimitReservedWord(tableName); }
return (StringUtil.IsBlank(schemaName) ? "" : schemaName + ".") + tableName;
}
//-------------------------------------------------------------------
// Identify the table that corresponds with the specified column.
@@ -157,8 +175,7 @@ namespace Sarand.Net.Standard.Base.Interfaces
String tableName = StringUtil.EmptyOnNull(tableAlias);
if (tableName.IsEmpty()) tableName = GetTableName(GetTableForColumn(column));
columnName = tableName + (tableName.Length > 0 ? "." : "") + columnName;
if (braces)
columnName = "(" + columnName + ")";
if (braces) columnName = $"({columnName})";
}
return columnName;
}
@@ -178,17 +195,24 @@ namespace Sarand.Net.Standard.Base.Interfaces
}
public static String DelimitReservedWord (String word)
{
if (!IsReservedWord(word)) return word;
switch (reservedWordDelim)
return IsReservedWord(word) ? DelimitWord(word) : word;
}
public static String DelimitWord (String word)
{
return DelimitWord(word, reservedWordDelim);
}
public static String DelimitWord (String word, DbReservedWordDelim wordDelim)
{
switch (wordDelim)
{
case DbReservedWordDelim.None:
break;
case DbReservedWordDelim.DoubleQuotes:
word = "\"" + word + "\"";
word = $"\"{word}\"";
break;
case DbReservedWordDelim.SquareBrackets:
default:
word = "[" + word + "]";
word = $"[{word}]";
break;
}
return word;
@@ -210,7 +234,7 @@ namespace Sarand.Net.Standard.Base.Interfaces
}
public static void SetMaxTextLen (ulong maxTextLen)
{
SaInterfaceDbDfn.maxTextLen = maxTextLen;
SaInterfaceDbDfn.MaxTextLen = maxTextLen;
}
public static bool IsColFmtText (ColumnIdx column)
{
@@ -225,7 +249,7 @@ namespace Sarand.Net.Standard.Base.Interfaces
if (columns[columnIdx].DataType == DbColumnDataType.VarChar)
{
ulong textLen = columns[columnIdx].DataLen;
if (maxTextLen > 0 && textLen > maxTextLen) textLen = maxTextLen;
if (MaxTextLen > 0 && textLen > MaxTextLen) textLen = MaxTextLen;
return textLen;
}
return 0;
@@ -256,18 +280,28 @@ namespace Sarand.Net.Standard.Base.Interfaces
//-------------------------------------------------------------------
// Table definitions.
private static readonly String[] tables =
private class TableDfn
{
"SaInterface",
"SaInterfaceDataItem",
"SaInterfaceProcess",
"SaInterfaceProcessDataItem",
"SaInterfaceProcessMessage",
internal String Schema { get; set; }
internal String Name { get; set; }
internal TableDfn (String schema, String name)
{
this.Schema= schema;
this.Name = name;
}
}
private static readonly TableDfn[] tables =
{
new TableDfn("dbo","SaInterface"),
new TableDfn("dbo","SaInterfaceDataItem"),
new TableDfn("dbo","SaInterfaceProcess"),
new TableDfn("dbo","SaInterfaceProcessDataItem"),
new TableDfn("dbo","SaInterfaceProcessMessage"),
};
//-------------------------------------------------------------------
// Table column definitions.
internal class ColumnDfn
private class ColumnDfn
{
internal TableIdx TableIdx { get; set; }
internal String Name { get; set; }
@@ -285,8 +319,6 @@ namespace Sarand.Net.Standard.Base.Interfaces
this.DataLen = dataLen;
}
}
//-------------------------------------------------------------------
private static readonly ColumnDfn[] columns =
{
new ColumnDfn(1,"Id",4,4,false,10),
@@ -294,7 +326,7 @@ namespace Sarand.Net.Standard.Base.Interfaces
new ColumnDfn(1,"Code",0,-9,false,32),
new ColumnDfn(1,"Category",3,5,false,5),
new ColumnDfn(1,"Type",3,5,false,5),
new ColumnDfn(1,"Caption",0,-9,false,50),
new ColumnDfn(1,"Caption",0,-9,false,100),
new ColumnDfn(1,"Notes",0,-9,false,255),
new ColumnDfn(1,"Flags",3,5,false,5),
new ColumnDfn(1,"Status",0,-9,false,3),
@@ -354,8 +386,8 @@ namespace Sarand.Net.Standard.Base.Interfaces
new ColumnDfn(4,"UpdateHost",0,-9,false,64),
new ColumnDfn(5,"Id",4,4,false,10),
new ColumnDfn(5,"ProcessId",4,4,false,10),
new ColumnDfn(5,"MsgType",0,12,false,3),
new ColumnDfn(5,"Msg",0,-9,false,1024),
new ColumnDfn(5,"MsgType",0,-9,false,3),
new ColumnDfn(5,"Msg",0,-9,false,4000),
new ColumnDfn(5,"FileName",0,-9,false,64),
new ColumnDfn(5,"LineNumber",4,4,false,10),
new ColumnDfn(5,"ItemType",3,5,false,5),
@@ -364,10 +396,10 @@ namespace Sarand.Net.Standard.Base.Interfaces
new ColumnDfn(5,"Status",0,12,false,3),
new ColumnDfn(5,"CreateOn",9,93,false,23),
new ColumnDfn(5,"CreateBy",4,4,false,10),
new ColumnDfn(5,"CreateHost",0,-9,false,64),
new ColumnDfn(5,"CreateHost",0,12,false,64),
new ColumnDfn(5,"UpdateOn",9,93,false,23),
new ColumnDfn(5,"UpdateBy",4,4,false,10),
new ColumnDfn(5,"UpdateHost",0,-9,false,64),
new ColumnDfn(5,"UpdateHost",0,12,false,64),
};
//-------------------------------------------------------------------
@@ -447,7 +479,7 @@ namespace Sarand.Net.Standard.Base.Interfaces
"VALUES",
"VIEW",
"WHEN",
"WHERE",
"WHERE"
};
//-------------------------------------------------------------------
@@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
namespace Sarand.Net.Standard.Base.Interfaces
{
@@ -60,8 +60,8 @@ namespace Sarand.Net.Standard.Base.Interfaces
public SaInterfaceProcessDirection Direction { get; set; } = SaInterfaceProcessDirection.Unknown;
public String Reference { get; set; } = String.Empty;
public int Sequence { get; set; } = 0;
public DateTime ProcessAt { get; set; } = DateTime.MinValue;
public DateTime BatchAt { get; set; } = DateTime.MinValue;
public DateTime? ProcessAt { get; set; } = DateTime.MinValue;
public DateTime? BatchAt { get; set; } = DateTime.MinValue;
public int ElapseSecs { get; set; } = 0;
}
@@ -97,15 +97,15 @@ namespace Sarand.Net.Standard.Base.Interfaces
get { return data.Sequence; }
set { CheckChanged(data.Sequence, value); data.Sequence = value; }
}
public DateTime ProcessAt
public DateTime? ProcessAt
{
get { return data.ProcessAt; }
set { CheckChanged(data.ProcessAt, value); data.ProcessAt = value; }
set { CheckChangedNullable(data.ProcessAt, value); data.ProcessAt = value; }
}
public DateTime BatchAt
public DateTime? BatchAt
{
get { return data.BatchAt; }
set { CheckChanged(data.BatchAt, value); data.BatchAt = value; }
set { CheckChangedNullable(data.BatchAt, value); data.BatchAt = value; }
}
public int ElapseSecs
{
@@ -237,12 +237,12 @@ namespace Sarand.Net.Standard.Base.Interfaces
get { return data.Sequence; }
protected set { data.Sequence = value; }
}
public DateTime ProcessAt
public DateTime? ProcessAt
{
get { return data.ProcessAt; }
set { data.ProcessAt = value; }
}
public DateTime BatchAt
public DateTime? BatchAt
{
get { return data.BatchAt; }
set { data.BatchAt = value; }
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:21
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:12
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Base.ItemOptions
{
@@ -48,7 +48,7 @@ namespace Sarand.Net.Standard.Base.ItemOptions
public static ulong MaxTextLen { get; private set; }
//-------------------------------------------------------------------
// Retrieve Table details (eg. name: 'Company').
// Retrieve Table details.
public static int GetTableCount ()
{
return tableCount;
@@ -106,8 +106,7 @@ namespace Sarand.Net.Standard.Base.ItemOptions
String tableName = StringUtil.EmptyOnNull(tableAlias);
if (tableName.IsEmpty()) tableName = GetTableName(GetTableForColumn(column));
columnName = tableName + (tableName.Length > 0 ? "." : "") + columnName;
if (braces)
columnName = "(" + columnName + ")";
if (braces) columnName = $"({columnName})";
}
return columnName;
}
@@ -140,11 +139,11 @@ namespace Sarand.Net.Standard.Base.ItemOptions
case DbReservedWordDelim.None:
break;
case DbReservedWordDelim.DoubleQuotes:
word = "\"" + word + "\"";
word = $"\"{word}\"";
break;
case DbReservedWordDelim.SquareBrackets:
default:
word = "[" + word + "]";
word = $"[{word}]";
break;
}
return word;
@@ -342,7 +341,7 @@ namespace Sarand.Net.Standard.Base.ItemOptions
"VALUES",
"VIEW",
"WHEN",
"WHERE",
"WHERE"
};
//-------------------------------------------------------------------
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:20
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:12
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Base.Security
{
@@ -74,7 +74,7 @@ namespace Sarand.Net.Standard.Base.Security
public static ulong MaxTextLen { get; private set; }
//-------------------------------------------------------------------
// Retrieve Table details (eg. name: 'Company').
// Retrieve Table details.
public static int GetTableCount ()
{
return tableCount;
@@ -132,8 +132,7 @@ namespace Sarand.Net.Standard.Base.Security
String tableName = StringUtil.EmptyOnNull(tableAlias);
if (tableName.IsEmpty()) tableName = GetTableName(GetTableForColumn(column));
columnName = tableName + (tableName.Length > 0 ? "." : "") + columnName;
if (braces)
columnName = "(" + columnName + ")";
if (braces) columnName = $"({columnName})";
}
return columnName;
}
@@ -166,11 +165,11 @@ namespace Sarand.Net.Standard.Base.Security
case DbReservedWordDelim.None:
break;
case DbReservedWordDelim.DoubleQuotes:
word = "\"" + word + "\"";
word = $"\"{word}\"";
break;
case DbReservedWordDelim.SquareBrackets:
default:
word = "[" + word + "]";
word = $"[{word}]";
break;
}
return word;
@@ -394,7 +393,7 @@ namespace Sarand.Net.Standard.Base.Security
"VALUES",
"VIEW",
"WHEN",
"WHERE",
"WHERE"
};
//-------------------------------------------------------------------
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.IO;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
namespace Sarand.Net.Standard.Dbas.Base
{
@@ -101,7 +101,8 @@ namespace Sarand.Net.Standard.Dbas.Base
// Data members.
private Config config = null;
private const String DefaultSchema_MSSQL = "dbo";
private static String /*lf = "\n",*/ crlf = "\r\n", tab1 = "\t", tab2 = "\t\t", tab3 = "\t\t\t", tab4 = "\t\t\t\t", tab5 = "\t\t\t\t\t";
private static String /*lf = "\n",*/ crlf = "\r\n", tab1 = "\t", tab2 = "\t\t", tab3 = "\t\t\t", tab4 = "\t\t\t\t"; /*, tab5 = "\t\t\t\t\t";*/
// Reserved words.
private static readonly String[] reservedWords =
{
@@ -118,7 +119,7 @@ namespace Sarand.Net.Standard.Dbas.Base
// Validate configuration.
this.config = config;
if (!FileUtil.IsDirectory(config.OutputDirectory))
throw new Exception("Invalid directory specified [" + config.OutputDirectory + "]");
throw new Exception($"Invalid directory specified [{config.OutputDirectory}]");
// Validate and cleanse configuration parameters.
if (StringUtil.IsEmpty(StringUtil.TrimAll(config.TableClass.BaseClass)))
@@ -136,6 +137,24 @@ namespace Sarand.Net.Standard.Dbas.Base
// Table definitions.
List<DbDfnTable> tableDfns = new List<DbDfnTable>(config.Database.GetTableDfns());
// Convert 'Alternative' table names found in database to standard table names.
Dictionary<String, DbDfnTable> tablesByName = tableDfns.ToDictionary(tbl => tbl.Name, tbl => tbl);
foreach (DbDfnTable tableDfn in tableDfns)
{
// Check whether tabl name is in 'Alternative' list.
String standardTableName = config.Schema.AlternativeTableNames.Where(kv => kv.Value.ContainsCI(tableDfn.Name)).Select(kv => kv.Key).FirstOrDefault();
if (StringUtil.IsBlank(standardTableName)) continue;
// Check that 'Standard' table name isn't already used.
if (tablesByName.ContainsKey(standardTableName))
throw new Exception($"Cannot map alternative table name '{tableDfn.Name}' to standard table name '{standardTableName}' as standard table name already exists in database.");
// Rename table.
tablesByName.Remove(tableDfn.Name);
tableDfn.ChangeTableName(standardTableName);
tablesByName[tableDfn.Name] = tableDfn;
}
// Database schema XML.
GenerateDatabaseSchemaXml(tableDfns.Where(item => IsValidTable(item.Name, DefinitionOutput.DatabaseSchema)));
@@ -152,8 +171,9 @@ namespace Sarand.Net.Standard.Dbas.Base
private bool IsValidTable(String table, DefinitionOutput output)
{
if (String.IsNullOrEmpty(table)) return false;
if (config.Schema.Tables_Included.Count > 0 && !config.Schema.Tables_Included.ContainsCI(table)) return false;
if (config.Schema.Tables_Excluded.Count > 0 && config.Schema.Tables_Excluded.ContainsCI(table)) return false;
if (config.Schema.Tables_Included.Any() && !config.Schema.Tables_Included.ContainsCI(table) && !config.Schema.Tables_Included.Any(tbl => config.Schema.AlternativeTableNames.GetValueOrDefault(tbl)?.ContainsCI(table) ?? false))
return false;
if (config.Schema.Tables_Excluded.ContainsCI(table)) return false;
// Tables excluded from specific output.
if (output == DefinitionOutput.DatabaseSchema && config.Schema.Tables_ExcludedFromDatabaseSchema.Contains(table)) return false;
if (output == DefinitionOutput.DatabaseDefinitionClass && config.Schema.Tables_ExcludedFromDatabaseDefinitionClass.Contains(table)) return false;
@@ -267,23 +287,23 @@ namespace Sarand.Net.Standard.Dbas.Base
{
// Database definition file:
foreach (String namespace_Base in config.DefinitionClass.Usings.OrderBy(s => s))
file.WriteLine("using " + namespace_Base + ";");
file.WriteLine($"using {namespace_Base};");
file.WriteLine("using System;");
file.WriteLine("using System.Collections.Generic;");
file.WriteLine("using System.Linq;");
file.WriteLine("");
file.WriteLine("//---------------------------------------------------------------------------");
file.WriteLine("// Code generated by Sarand Database Utilities " + DateTime.Now.Format("ddd d-MMM-yyyy HH:mm:ss"));
file.WriteLine($"// Code generated by Sarand Database Utilities {DateTime.Now.Format("ddd d-MMM-yyyy HH:mm:ss")}");
file.WriteLine("//---------------------------------------------------------------------------");
file.WriteLine("namespace " + config.DefinitionClass.Namespace);
file.WriteLine($"namespace {config.DefinitionClass.Namespace}");
file.WriteLine("{");
file.WriteLine(tab1 + "public class " + config.DefinitionClass.Classname);
file.WriteLine(tab1 + "{");
file.WriteLine(tab2 + "//-------------------------------------------------------------------");
file.WriteLine($"{tab1}public class {config.DefinitionClass.Classname}");
file.WriteLine($"{tab1}{{");
GenerateDatabaseDefinitionTablesEnum(tableDfns, file);
GenerateDatabaseDefinitionColumnsEnum(tableDfns, file);
GenerateDatabaseDefinitionClass(tableDfns, config.DefinitionClass.Classname, file);
file.WriteLine(tab1 + "}");
file.WriteLine($"{crlf}{tab2}//-------------------------------------------------------------------");
file.WriteLine($"{tab1}}}");
file.WriteLine("}");
//file.Close(); - Unecessary as the object will be disposed at the end of the 'using' block which is the same as Close.
}
@@ -294,270 +314,279 @@ namespace Sarand.Net.Standard.Dbas.Base
//-------------------------------------------------------------------
public static void GenerateDatabaseDefinitionTablesEnum(IEnumerable<DbDfnTable> tableDfns, StreamWriter file)
{
file.WriteLine(tab2 + "// Table identifiers.");
file.WriteLine(tab2 + "public enum TableIdx");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "Unknown = 0,");
foreach (DbDfnTable tableDfn in tableDfns)
// No need or CR before opening comment line as at top of class.
file.WriteLine(@" //-------------------------------------------------------------------
// Table identifiers.
public enum TableIdx
{
file.WriteLine(tab3 + tableDfn.Name + ",");
}
file.WriteLine(tab2 + "}");
file.WriteLine(crlf + tab2 + "//-------------------------------------------------------------------");
Unknown = 0,");
foreach (DbDfnTable tableDfn in tableDfns)
file.WriteLine($"{tab3}{tableDfn.Name},");
file.WriteLine($"{tab2}}}");
}
//-------------------------------------------------------------------
public static void GenerateDatabaseDefinitionColumnsEnum(IEnumerable<DbDfnTable> tableDfns, StreamWriter file)
{
file.WriteLine(tab2 + "// Column identifiers.");
file.WriteLine(tab2 + "public enum ColumnIdx");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "Unknown = 0,");
file.WriteLine(@"
//-------------------------------------------------------------------
// Column identifiers.
public enum ColumnIdx
{
Unknown = 0,");
foreach (DbDfnTable tableDfn in tableDfns)
{
foreach (var columnDfn in tableDfn.Columns)
file.WriteLine(tab3 + tableDfn.Name + "_" + columnDfn.Name + ",");
file.WriteLine($"{tab3}{tableDfn.Name}_{columnDfn.Name},");
}
file.WriteLine(tab2 + "}");
file.WriteLine(crlf + tab2 + "//-------------------------------------------------------------------");
file.WriteLine($"{tab2}}}");
}
//-------------------------------------------------------------------
public static void GenerateDatabaseDefinitionClass(IEnumerable<DbDfnTable> tableDfns, String classnameDefinition, StreamWriter file)
{
file.WriteLine(tab2 + "// Data members.");
file.WriteLine(tab2 + "private static readonly int tableCount = " + tableDfns.Count() + ";");
file.WriteLine(tab2 + "private static readonly int columnCount = " + tableDfns.GetColumnCount() + ";");
file.WriteLine(tab2 + "public static ulong MaxTextLen { get; private set; }");
file.WriteLine(crlf + tab2 + "//-------------------------------------------------------------------");
// Data members.
file.WriteLine(@$"
//-------------------------------------------------------------------
// Data members.
private static readonly int tableCount = {tableDfns.Count()};
private static readonly int columnCount = {tableDfns.GetColumnCount()};
public static ulong MaxTextLen {{ get; private set; }}");
// Table methods.
file.WriteLine(tab2 + "// Retrieve Table details (eg. name: 'Company').");
file.WriteLine(tab2 + "public static int GetTableCount ()");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "return tableCount;");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static String GetSchemaName (TableIdx table, bool delimitReservedWords = true)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "int tableIdx = (int)table - 1;");
file.WriteLine(tab3 + "if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;");
file.WriteLine(tab3 + "String schemaName = tables[(int)tableIdx].Schema;");
file.WriteLine(tab3 + "if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); }");
file.WriteLine(tab3 + "return schemaName;");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static String GetTableName (TableIdx table, bool delimitReservedWords = true)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "int tableIdx = (int)table - 1;");
file.WriteLine(tab3 + "if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;");
file.WriteLine(tab3 + "String tableName = tables[(int)tableIdx].Name;");
file.WriteLine(tab3 + "if (delimitReservedWords) tableName = DelimitReservedWord(tableName);");
file.WriteLine(tab3 + "return tableName;");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static String GetTableNameQual (TableIdx table, bool delimitReservedWords = true)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "int tableIdx = (int)table - 1;");
file.WriteLine(tab3 + "if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;");
file.WriteLine(tab3 + "String schemaName = tables[(int)tableIdx].Schema;");
file.WriteLine(tab3 + "String tableName = tables[(int)tableIdx].Name;");
file.WriteLine(tab3 + "if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); tableName = DelimitReservedWord(tableName); }");
file.WriteLine(tab3 + "return (StringUtil.IsBlank(schemaName) ? \"\" : schemaName + \".\") + tableName;");
file.WriteLine(tab2 + "}");
file.WriteLine(crlf + tab2 + "//-------------------------------------------------------------------");
file.WriteLine(@"
//-------------------------------------------------------------------
// Retrieve Table details.
public static int GetTableCount ()
{
return tableCount;
}
public static String GetSchemaName (TableIdx table, bool delimitReservedWords = true)
{
int tableIdx = (int)table - 1;
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
String schemaName = tables[(int)tableIdx].Schema;
if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); }
return schemaName;
}
public static String GetTableName (TableIdx table, bool delimitReservedWords = true)
{
int tableIdx = (int)table - 1;
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
String tableName = tables[(int)tableIdx].Name;
if (delimitReservedWords) tableName = DelimitReservedWord(tableName);
return tableName;
}
public static String GetTableNameQual (TableIdx table, bool delimitReservedWords = true)
{
int tableIdx = (int)table - 1;
if (tableIdx < 0 || tableIdx >= tableCount) return String.Empty;
String schemaName = tables[(int)tableIdx].Schema;
String tableName = tables[(int)tableIdx].Name;
if (delimitReservedWords) { schemaName = DelimitReservedWord(schemaName); tableName = DelimitReservedWord(tableName); }
return (StringUtil.IsBlank(schemaName) ? """" : schemaName + ""."") + tableName;
}");
// Table for Column method.
file.WriteLine(tab2 + "// Identify the table that corresponds with the specified column.");
file.WriteLine(tab2 + "public static TableIdx GetTableForColumn (ColumnIdx column)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "int columnIdx = (int)column - 1;");
file.WriteLine(tab3 + "if (columnIdx < 0 || columnIdx >= columnCount) return TableIdx.Unknown;");
file.WriteLine(tab3 + "return columns[columnIdx].TableIdx;");
file.WriteLine(tab2 + "}");
file.WriteLine(crlf + tab2 + "//-------------------------------------------------------------------");
file.WriteLine(@"
//-------------------------------------------------------------------
// Identify the table that corresponds with the specified column.
public static TableIdx GetTableForColumn (ColumnIdx column)
{
int columnIdx = (int)column - 1;
if (columnIdx < 0 || columnIdx >= columnCount) return TableIdx.Unknown;
return columns[columnIdx].TableIdx;
}");
// Column methods.
file.WriteLine(tab2 + "// Retrieve the specified Column's name (Qualified include table name: '(<Table>.Column>)').");
file.WriteLine(tab2 + "public static String GetColumnName (ColumnIdx column, bool delimitReservedWords = true)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "int columnIdx = (int)column - 1;");
file.WriteLine(tab3 + "if (columnIdx < 0 || columnIdx >= columnCount) return String.Empty;");
file.WriteLine(tab3 + "String columnName = columns[columnIdx].Name;");
file.WriteLine(tab3 + "if (delimitReservedWords) columnName = DelimitReservedWord(columnName);");
file.WriteLine(tab3 + "return columnName;");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static String GetColumnNameQual (ColumnIdx column, String tableAlias = \"\", bool braces = false)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "String columnName = GetColumnName(column);");
file.WriteLine(tab3 + "if (!String.IsNullOrEmpty(columnName))");
file.WriteLine(tab3 + "{");
file.WriteLine(tab4 + "String tableName = StringUtil.EmptyOnNull(tableAlias);");
file.WriteLine(tab4 + "if (tableName.IsEmpty()) tableName = GetTableName(GetTableForColumn(column));");
file.WriteLine(tab4 + "columnName = tableName + (tableName.Length > 0 ? \".\" : \"\") + columnName;");
file.WriteLine(tab4 + "if (braces)");
file.WriteLine(tab5 + "columnName = \"(\" + columnName + \")\";");
file.WriteLine(tab3 + "}");
file.WriteLine(tab3 + "return columnName;");
file.WriteLine(tab2 + "}");
file.WriteLine(crlf + tab2 + "//-------------------------------------------------------------------");
file.WriteLine(@"
//-------------------------------------------------------------------
// Retrieve the specified Column's name (Qualified include table name: '(<Table>.Column>)').
public static String GetColumnName (ColumnIdx column, bool delimitReservedWords = true)
{
int columnIdx = (int)column - 1;
if (columnIdx < 0 || columnIdx >= columnCount) return String.Empty;
String columnName = columns[columnIdx].Name;
if (delimitReservedWords) columnName = DelimitReservedWord(columnName);
return columnName;
}
public static String GetColumnNameQual (ColumnIdx column, String tableAlias = """", bool braces = false)
{
String columnName = GetColumnName(column);
if (!String.IsNullOrEmpty(columnName))
{
String tableName = StringUtil.EmptyOnNull(tableAlias);
if (tableName.IsEmpty()) tableName = GetTableName(GetTableForColumn(column));
columnName = tableName + (tableName.Length > 0 ? ""."" : """") + columnName;
if (braces) columnName = $""({columnName})"";
}
return columnName;
}");
// Reserved word methods.
file.WriteLine(tab2 + "// Reserved words.");
file.WriteLine(tab2 + "private static DbReservedWordDelim reservedWordDelim = DbReservedWordDelim.SquareBrackets;");
file.WriteLine(tab2 + "public static void SetReservedWordDelim (DbReservedWordDelim reservedWordDelim)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + classnameDefinition + ".reservedWordDelim = reservedWordDelim;");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static bool IsReservedWord (String word)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "if (String.IsNullOrEmpty(word)) return false;");
file.WriteLine(tab3 + "if (reservedWords.Contains(word, StringComparer.OrdinalIgnoreCase)) return true;");
file.WriteLine(tab3 + "return false;");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static String DelimitReservedWord (String word)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "return IsReservedWord(word) ? DelimitWord(word) : word;");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static String DelimitWord (String word)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "return DelimitWord(word, reservedWordDelim);");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static String DelimitWord (String word, DbReservedWordDelim wordDelim)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "switch (wordDelim)");
file.WriteLine(tab3 + "{");
file.WriteLine(tab4 + "case DbReservedWordDelim.None:");
file.WriteLine(tab5 + "break;");
file.WriteLine(tab4 + "case DbReservedWordDelim.DoubleQuotes:");
file.WriteLine(tab5 + "word = \"\\\"\" + word + \"\\\"\"; ");
file.WriteLine(tab5 + "break;");
file.WriteLine(tab4 + "case DbReservedWordDelim.SquareBrackets:");
file.WriteLine(tab4 + "default:");
file.WriteLine(tab5 + "word = \"[\" + word + \"]\"; ");
file.WriteLine(tab5 + "break;");
file.WriteLine(tab3 + "}");
file.WriteLine(tab3 + "return word;");
file.WriteLine(tab2 + "}");
file.WriteLine(crlf + tab2 + "//-------------------------------------------------------------------");
file.WriteLine(@"
//-------------------------------------------------------------------
// Reserved words.
private static DbReservedWordDelim reservedWordDelim = DbReservedWordDelim.SquareBrackets;
public static void SetReservedWordDelim (DbReservedWordDelim reservedWordDelim)
{
" + classnameDefinition + @".reservedWordDelim = reservedWordDelim;
}
public static bool IsReservedWord (String word)
{
if (String.IsNullOrEmpty(word)) return false;
if (reservedWords.Contains(word, StringComparer.OrdinalIgnoreCase)) return true;
return false;
}
public static String DelimitReservedWord (String word)
{
return IsReservedWord(word) ? DelimitWord(word) : word;
}
public static String DelimitWord (String word)
{
return DelimitWord(word, reservedWordDelim);
}
public static String DelimitWord (String word, DbReservedWordDelim wordDelim)
{
switch (wordDelim)
{
case DbReservedWordDelim.None:
break;
case DbReservedWordDelim.DoubleQuotes:
word = $""\""{word}\"""";
break;
case DbReservedWordDelim.SquareBrackets:
default:
word = $""[{word}]"";
break;
}
return word;
}");
// Column information methods.
file.WriteLine(tab2 + "// Retrieve information about the specified Column.");
file.WriteLine(tab2 + "public static DbColumnDataType GetColDataType (ColumnIdx column)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "int columnIdx = (int)column - 1;");
file.WriteLine(tab3 + "if (columnIdx < 0 || columnIdx >= columnCount) return DbColumnDataType.Unknown;");
file.WriteLine(tab3 + "return columns[columnIdx].DataType;");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static short GetColNativeDataType (ColumnIdx column)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "int columnIdx = (int)column - 1;");
file.WriteLine(tab3 + "if (columnIdx < 0 || columnIdx >= columnCount) return 0;");
file.WriteLine(tab3 + "return columns[columnIdx].NativeDataType;");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static void SetMaxTextLen (ulong maxTextLen)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + classnameDefinition + ".MaxTextLen = maxTextLen;");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static bool IsColFmtText (ColumnIdx column)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "int columnIdx = (int)column - 1;");
file.WriteLine(tab3 + "if (columnIdx < 0 || columnIdx >= columnCount) return false;");
file.WriteLine(tab3 + "return (columns[columnIdx].DataType == DbColumnDataType.VarChar);");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static ulong GetColTextLen (ColumnIdx column)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "int columnIdx = (int)column - 1;");
file.WriteLine(tab3 + "if (columnIdx < 0 || columnIdx >= columnCount) return 0;");
file.WriteLine(tab3 + "if (columns[columnIdx].DataType == DbColumnDataType.VarChar)");
file.WriteLine(tab3 + "{");
file.WriteLine(tab4 + "ulong textLen = columns[columnIdx].DataLen;");
file.WriteLine(tab4 + "if (MaxTextLen > 0 && textLen > MaxTextLen) textLen = MaxTextLen;");
file.WriteLine(tab4 + "return textLen;");
file.WriteLine(tab3 + "}");
file.WriteLine(tab3 + "return 0;");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static bool IsColFmtBool (ColumnIdx column)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "int columnIdx = (int)column - 1;");
file.WriteLine(tab3 + "if (columnIdx < 0 || columnIdx >= columnCount) return false;");
file.WriteLine(tab3 + "return (columns[columnIdx].DataType == DbColumnDataType.Bit);");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "public static bool IsColFmtNumeric (ColumnIdx column)");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "int columnIdx = (int)column - 1;");
file.WriteLine(tab3 + "if (columnIdx < 0 || columnIdx >= columnCount) return false;");
file.WriteLine(tab3 + "switch (columns[columnIdx].DataType)");
file.WriteLine(tab3 + "{");
file.WriteLine(tab4 + "case DbColumnDataType.TinyInt:");
file.WriteLine(tab4 + "case DbColumnDataType.SmallInt:");
file.WriteLine(tab4 + "case DbColumnDataType.Int:");
file.WriteLine(tab4 + "case DbColumnDataType.BigInt:");
file.WriteLine(tab4 + "case DbColumnDataType.Single:");
file.WriteLine(tab4 + "case DbColumnDataType.Double:");
file.WriteLine(tab4 + "case DbColumnDataType.Decimal:");
file.WriteLine(tab5 + "return true;");
file.WriteLine(tab3 + "}");
file.WriteLine(tab3 + "return false;");
file.WriteLine(tab2 + "}");
file.WriteLine(crlf + tab2 + "//-------------------------------------------------------------------");
file.WriteLine(@"
//-------------------------------------------------------------------
// Retrieve information about the specified Column.
public static DbColumnDataType GetColDataType (ColumnIdx column)
{
int columnIdx = (int)column - 1;
if (columnIdx < 0 || columnIdx >= columnCount) return DbColumnDataType.Unknown;
return columns[columnIdx].DataType;
}
public static short GetColNativeDataType (ColumnIdx column)
{
int columnIdx = (int)column - 1;
if (columnIdx < 0 || columnIdx >= columnCount) return 0;
return columns[columnIdx].NativeDataType;
}
public static void SetMaxTextLen (ulong maxTextLen)
{
" + classnameDefinition + @".MaxTextLen = maxTextLen;
}
public static bool IsColFmtText (ColumnIdx column)
{
int columnIdx = (int)column - 1;
if (columnIdx < 0 || columnIdx >= columnCount) return false;
return (columns[columnIdx].DataType == DbColumnDataType.VarChar);
}
public static ulong GetColTextLen (ColumnIdx column)
{
int columnIdx = (int)column - 1;
if (columnIdx < 0 || columnIdx >= columnCount) return 0;
if (columns[columnIdx].DataType == DbColumnDataType.VarChar)
{
ulong textLen = columns[columnIdx].DataLen;
if (MaxTextLen > 0 && textLen > MaxTextLen) textLen = MaxTextLen;
return textLen;
}
return 0;
}
public static bool IsColFmtBool (ColumnIdx column)
{
int columnIdx = (int)column - 1;
if (columnIdx < 0 || columnIdx >= columnCount) return false;
return (columns[columnIdx].DataType == DbColumnDataType.Bit);
}
public static bool IsColFmtNumeric (ColumnIdx column)
{
int columnIdx = (int)column - 1;
if (columnIdx < 0 || columnIdx >= columnCount) return false;
switch (columns[columnIdx].DataType)
{
case DbColumnDataType.TinyInt:
case DbColumnDataType.SmallInt:
case DbColumnDataType.Int:
case DbColumnDataType.BigInt:
case DbColumnDataType.Single:
case DbColumnDataType.Double:
case DbColumnDataType.Decimal:
return true;
}
return false;
}");
// Table names.
file.WriteLine(tab2 + "// Table definitions.");
file.WriteLine(tab2 + "private class TableDfn");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "internal String Schema { get; set; }");
file.WriteLine(tab3 + "internal String Name { get; set; }");
file.WriteLine(tab3 + "internal TableDfn (String schema, String name)");
file.WriteLine(tab3 + "{");
file.WriteLine(tab4 + "this.Schema= schema;");
file.WriteLine(tab4 + "this.Name = name;");
file.WriteLine(tab3 + "}");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "private static readonly TableDfn[] tables =");
file.WriteLine(tab2 + "{");
file.WriteLine(@"
//-------------------------------------------------------------------
// Table definitions.
private class TableDfn
{
internal String Schema { get; set; }
internal String Name { get; set; }
internal TableDfn (String schema, String name)
{
this.Schema= schema;
this.Name = name;
}
}
private static readonly TableDfn[] tables =
{");
foreach (DbDfnTable tableDfn in tableDfns)
file.WriteLine(tab3 + "new TableDfn(\"" + tableDfn.Schema + "\",\"" + tableDfn.Name + "\"),");
file.WriteLine(tab2 + "};");
file.WriteLine(crlf + tab2 + "//-------------------------------------------------------------------");
file.WriteLine($"{tab2}}};");
// Table Column definitions.
file.WriteLine(tab2 + "// Table column definitions.");
file.WriteLine(tab2 + "private class ColumnDfn");
file.WriteLine(tab2 + "{");
file.WriteLine(tab3 + "internal TableIdx TableIdx { get; set; }");
file.WriteLine(tab3 + "internal String Name { get; set; }");
file.WriteLine(tab3 + "internal DbColumnDataType DataType { get; set; }");
file.WriteLine(tab3 + "internal short NativeDataType { get; set; }");
file.WriteLine(tab3 + "internal bool IsIdentity { get; set; }");
file.WriteLine(tab3 + "internal ulong DataLen { get; set; }");
file.WriteLine(tab3 + "internal ColumnDfn (int tableIdx, String name, int dataType, short nativeDataType, bool isIdentity, ulong dataLen)");
file.WriteLine(tab3 + "{");
file.WriteLine(tab4 + "this.TableIdx = (TableIdx)tableIdx;");
file.WriteLine(tab4 + "this.Name = name;");
file.WriteLine(tab4 + "this.DataType = (DbColumnDataType)dataType;");
file.WriteLine(tab4 + "this.NativeDataType = nativeDataType;");
file.WriteLine(tab4 + "this.IsIdentity = isIdentity;");
file.WriteLine(tab4 + "this.DataLen = dataLen;");
file.WriteLine(tab3 + "}");
file.WriteLine(tab2 + "}");
file.WriteLine(tab2 + "private static readonly ColumnDfn[] columns =");
file.WriteLine(tab2 + "{");
file.WriteLine(@"
//-------------------------------------------------------------------
// Table column definitions.
private class ColumnDfn
{
internal TableIdx TableIdx { get; set; }
internal String Name { get; set; }
internal DbColumnDataType DataType { get; set; }
internal short NativeDataType { get; set; }
internal bool IsIdentity { get; set; }
internal ulong DataLen { get; set; }
internal ColumnDfn (int tableIdx, String name, int dataType, short nativeDataType, bool isIdentity, ulong dataLen)
{
this.TableIdx = (TableIdx)tableIdx;
this.Name = name;
this.DataType = (DbColumnDataType)dataType;
this.NativeDataType = nativeDataType;
this.IsIdentity = isIdentity;
this.DataLen = dataLen;
}
}
private static readonly ColumnDfn[] columns =
{");
uint tableIdx = 0;
foreach (DbDfnTable tableDfn in tableDfns)
{
tableIdx++;
foreach (var columnDfn in tableDfn.Columns)
file.WriteLine(tab3 + "new ColumnDfn(" + tableIdx.ToString() + ",\"" + columnDfn.Name + "\"," + ((int)columnDfn.DataType).ToString() + "," + columnDfn.DataTypeNative.ToString() + "," + (columnDfn.IsIdentity ? "true" : "false") + "," + columnDfn.Size.ToString() + "),");
file.WriteLine($"{tab3}new ColumnDfn({tableIdx},\"{columnDfn.Name}\",{(int)columnDfn.DataType},{columnDfn.DataTypeNative},{(columnDfn.IsIdentity ? "true" : "false")},{columnDfn.Size}),");
}
file.WriteLine(tab2 + "};");
file.WriteLine(crlf + tab2 + "//-------------------------------------------------------------------");
file.WriteLine($"{tab2}}};");
// Reserved words.
file.WriteLine(tab2 + "// Reserved words.");
file.WriteLine(tab2 + "private static readonly HashSet<String> reservedWords = new HashSet<String>()");
file.WriteLine(tab2 + "{");
foreach (String reservedword in reservedWords)
file.WriteLine(tab3 + "\"" + reservedword + "\", ");
file.WriteLine(tab2 + "};");
file.WriteLine(crlf + tab2 + "//-------------------------------------------------------------------");
file.WriteLine(@"
//-------------------------------------------------------------------
// Reserved words.
private static readonly HashSet<String> reservedWords = new HashSet<String>()
{
" + reservedWords.Concat($",{crlf}{tab3}", "\"", "\"") + @"
};");
}
//-------------------------------------------------------------------
@@ -631,23 +660,23 @@ namespace Sarand.Net.Standard.Dbas.Base
file.WriteLine(tab2 + "// Data members.");
file.WriteLine(tab2 + "protected static List<String> fields { get; } = new List<String>()");
file.WriteLine(tab2 + "{");
foreach (var columnDfn in tableDfn.Columns) file.WriteLine(tab3 + "\"" + columnDfn.Name + "\",");
foreach (var columnDfn in tableDfn.Columns) file.WriteLine($"{tab3}\"{columnDfn.Name}\",");
file.WriteLine(tab2 + "};");
file.WriteLine(tab2 + "protected static List<String> fieldsId { get; } = new List<String>()");
file.WriteLine(tab2 + "{");
foreach (var columnDfn in tableDfn.Columns.FindAll(item => item.IsIdentity)) file.WriteLine(tab3 + "\"" + columnDfn.Name + "\",");
foreach (var columnDfn in tableDfn.Columns.FindAll(item => item.IsIdentity)) file.WriteLine($"{tab3}\"{columnDfn.Name}\",");
file.WriteLine(tab2 + "};");
file.WriteLine(tab2 + "protected static List<String> fieldsPrimary { get; } = new List<String>()");
file.WriteLine(tab2 + "{");
foreach (String columnName in primaryColumnNames) file.WriteLine(tab3 + "\"" + columnName + "\",");
foreach (String columnName in primaryColumnNames) file.WriteLine($"{tab3}\"{columnName}\",");
file.WriteLine(tab2 + "};");
file.WriteLine(tab2 + "protected static List<String> fieldsNullable { get; } = new List<String>()");
file.WriteLine(tab2 + "{");
foreach (var columnDfn in tableDfn.Columns.FindAll(item => item.IsNullable)) file.WriteLine(tab3 + "\"" + columnDfn.Name + "\",");
foreach (var columnDfn in tableDfn.Columns.FindAll(item => item.IsNullable)) file.WriteLine($"{tab3}\"{columnDfn.Name}\",");
file.WriteLine(tab2 + "};");
file.WriteLine(tab2 + "protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()");
file.WriteLine(tab2 + "{");
foreach (String columnName in columnsIgnoredOnUpdate) file.WriteLine(tab3 + "\"" + columnName + "\",");
foreach (String columnName in columnsIgnoredOnUpdate) file.WriteLine($"{tab3}\"{columnName}\",");
file.WriteLine(tab2 + "};");
/*
file.WriteLine(tab2 + "protected static List<String> fieldsNonId { get; } = new List<String>()");
@@ -668,14 +697,14 @@ namespace Sarand.Net.Standard.Dbas.Base
// Properties.
file.WriteLine(crlf + tab2 + "//-------------------------------------------------------------------");
file.WriteLine(tab2 + "// Properties.");
file.WriteLine(tab2 + "public override String SchemaName { get; } = \"" + tableDfn.Schema + "\";");
file.WriteLine(tab2 + $"public override String SchemaName {{ get; }} = \"{tableDfn.Schema}\";");
if (alternativeTableNames.Count == 0)
file.WriteLine(tab2 + "public override String TableName { get; } = \"" + tableDfn.Name + "\";");
file.WriteLine(tab2 + $"public override String TableName {{ get; }} = \"{tableDfn.Name}\";");
else
{
// Logic to handle alternative table names.
file.WriteLine(tab2 + "public override String TableName { get { return GetActualTableName(\"" + tableDfn.Name + "\"); } }");
file.WriteLine(tab2 + "public override List<String> AlternativeTableNames { get; } = new List<string>() { " + alternativeTableNames.Concat(", ", "\"", "\"") + " };");
file.WriteLine(tab2 + $"public override String TableName {{ get {{ return GetActualTableName(\"{tableDfn.Name}\"); }} }}");
file.WriteLine(tab2 + $"public override List<String> AlternativeTableNames {{ get; }} = new List<string>() {{ {alternativeTableNames.Concat(", ", "\"", "\"")} }};");
}
file.WriteLine(tab2 + "public String TableNameFmt { get { return (!String.IsNullOrEmpty(SchemaName) ? \"[\" + SchemaName + \"].\" : \"\") + \"[\" + TableName + \"]\"; } }");
file.WriteLine(tab2 + "public static List<String> Fields { get { return new List<String>(fields); } }");
@@ -684,7 +713,7 @@ namespace Sarand.Net.Standard.Dbas.Base
file.WriteLine(tab2 + "// Columns.");
file.WriteLine(tab2 + "public ColumnsData Cols { get; } = new ColumnsData();");
foreach (var columnDfn in tableDfn.Columns)
file.WriteLine(tab2 + "public " + GetColumnVariableType(columnDfn) + (TreatColumnAsNullable(columnDfn) ? "?" : "") + " _" + columnDfn.Name + " { get { return Cols._" + columnDfn.Name + ".Value; } set { Cols._" + columnDfn.Name + ".Value = value; } }");
file.WriteLine(tab2 + $"public {GetColumnVariableType(columnDfn)}{(TreatColumnAsNullable(columnDfn) ? "?" : "")} _{columnDfn.Name} {{ get {{ return Cols._{columnDfn.Name}.Value; }} set {{ Cols._{columnDfn.Name}.Value = value; }} }}");
file.WriteLine(tab2 + "// Existing columns - confirmed on database if table exists.");
file.WriteLine(tab2 + "public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }");
file.WriteLine(tab2 + "public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }");
+19 -14
View File
@@ -1,16 +1,16 @@
using System;
using Microsoft.Win32;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Dbas.Data;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.Win32;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Dbas.Data;
namespace Sarand.Net.Standard.Dbas.Base
{
@@ -209,19 +209,24 @@ namespace Sarand.Net.Standard.Dbas.Base
columnNameValues.Add(columnName, SysId.ToInt(value).ToString());
}
/// <summary>Add numeric value pair - used to build value lists for insert and update.</summary>
public static void AddValuePair(List<StringPair> columnNameValues, String columnName, long value)
public static void AddValuePair(List<StringPair> columnNameValues, String columnName, Int32? value)
{
columnNameValues.Add(columnName, value.ToString());
columnNameValues.Add(columnName, value is null ? "NULL" : $"{value}");
}
/// <summary>Add numeric value pair - used to build value lists for insert and update.</summary>
public static void AddValuePair(List<StringPair> columnNameValues, String columnName, Int64? value)
{
columnNameValues.Add(columnName, value is null ? "NULL" : $"{value}");
}
/// <summary>Add decimal value pair - used to build value lists for insert and update.</summary>
public static void AddValuePair(List<StringPair> columnNameValues, String columnName, decimal value)
public static void AddValuePair(List<StringPair> columnNameValues, String columnName, decimal? value)
{
columnNameValues.Add(columnName, value.ToString());
columnNameValues.Add(columnName, value is null ? "NULL" : $"{value}");
}
/// <summary>Add date/time value pair - used to build value lists for insert and update.</summary>
public static void AddValuePair(List<StringPair> columnNameValues, String columnName, DateTime value)
public static void AddValuePair(List<StringPair> columnNameValues, String columnName, DateTime? value)
{
AddValuePair(columnNameValues, columnName, DateUtil.Format(value, "yyyy/MM/dd HH:mm:ss"), true);
AddValuePair(columnNameValues, columnName, value is null ? "NULL" : DateUtil.Format(value, "yyyy/MM/dd HH:mm:ss"), true);
}
// Specific queries.
public abstract long GetRowCount(String tableName, String filter);
@@ -10,7 +10,7 @@ using System.Data.Common;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:21
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:12
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
{
@@ -10,7 +10,7 @@ using System.Data.Common;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:21
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:12
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Dbas.CodeTypes.Internal
{
@@ -22,7 +22,7 @@ namespace Sarand.Net.Standard.Dbas.CodeType
/// </summary>
public static bool Generate(String connectionString)
{
String fn = className + ".Generate";
String fn = $"{className}.Generate";
// Locate output folder:
String directory = GetOutputFolder();
@@ -87,7 +87,7 @@ namespace Sarand.Net.Standard.Dbas.CodeType
//-------------------------------------------------------------------
private static String GetOutputFolder()
{
String fn = className + ".GetOutputFolder";
String fn = $"{className}.GetOutputFolder";
String assemblyDirectory = FileUtil.GetParentDirectory((Assembly.GetAssembly(typeof(DatabaseDefinitionGenerator)).Location));
String directory = assemblyDirectory;
SaLogger.Debug($"{fn} Assembly folder: {directory}");
@@ -1,15 +1,16 @@
using Microsoft.Data.SqlClient;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Dbas.Data;
using System;
using System.Collections.Generic;
using System.Data.Common;
using Microsoft.Data.SqlClient;
using System.Linq;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:58
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:13
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
{
@@ -26,24 +27,24 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
public ColumnDataInt16 _ItemType { get; } = new ColumnDataInt16("ItemType");
public ColumnDataInt32 _ItemId { get; } = new ColumnDataInt32("ItemId");
public ColumnDataString _ProcessStatus { get; } = new ColumnDataString("ProcessStatus");
public ColumnDataInt32 _ProcessStatusBy { get; } = new ColumnDataInt32("ProcessStatusBy");
public ColumnDataDateTime _ProcessStatusAt { get; } = new ColumnDataDateTime("ProcessStatusAt");
public ColumnDataInt32Nullable _ProcessStatusBy { get; } = new ColumnDataInt32Nullable("ProcessStatusBy");
public ColumnDataDateTimeNullable _ProcessStatusAt { get; } = new ColumnDataDateTimeNullable("ProcessStatusAt");
public ColumnDataString _ItemStatus { get; } = new ColumnDataString("ItemStatus");
public ColumnDataInt32 _ItemStatusBy { get; } = new ColumnDataInt32("ItemStatusBy");
public ColumnDataDateTime _ItemStatusAt { get; } = new ColumnDataDateTime("ItemStatusAt");
public ColumnDataInt32Nullable _ItemStatusBy { get; } = new ColumnDataInt32Nullable("ItemStatusBy");
public ColumnDataDateTimeNullable _ItemStatusAt { get; } = new ColumnDataDateTimeNullable("ItemStatusAt");
public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
public ColumnDataInt16Nullable _Flags { get; } = new ColumnDataInt16Nullable("Flags");
public ColumnDataDateTimeNullable _CreateOn { get; } = new ColumnDataDateTimeNullable("CreateOn");
public ColumnDataInt32Nullable _CreateBy { get; } = new ColumnDataInt32Nullable("CreateBy");
public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
public ColumnDataDateTimeNullable _UpdateOn { get; } = new ColumnDataDateTimeNullable("UpdateOn");
public ColumnDataInt32Nullable _UpdateBy { get; } = new ColumnDataInt32Nullable("UpdateBy");
public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
}
//-------------------------------------------------------------------
// Data members.
private static List<String> fields { get; } = new List<String>()
protected static List<String> fields { get; } = new List<String>()
{
"Id",
"InterfaceId",
@@ -66,14 +67,32 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
"UpdateBy",
"UpdateHost",
};
private static List<String> fieldsId { get; } = new List<String>()
protected static List<String> fieldsId { get; } = new List<String>()
{
};
private static List<String> fieldsPrimary { get; } = new List<String>()
protected static List<String> fieldsPrimary { get; } = new List<String>()
{
"Id",
};
private static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
protected static List<String> fieldsNullable { get; } = new List<String>()
{
"ExternalRef",
"ProcessStatus",
"ProcessStatusBy",
"ProcessStatusAt",
"ItemStatus",
"ItemStatusBy",
"ItemStatusAt",
"Notes",
"Flags",
"CreateOn",
"CreateBy",
"CreateHost",
"UpdateOn",
"UpdateBy",
"UpdateHost",
};
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
{
"CreateOn",
"CreateBy",
@@ -108,22 +127,23 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
public Int16 _ItemType { get { return Cols._ItemType.Value; } set { Cols._ItemType.Value = value; } }
public Int32 _ItemId { get { return Cols._ItemId.Value; } set { Cols._ItemId.Value = value; } }
public String _ProcessStatus { get { return Cols._ProcessStatus.Value; } set { Cols._ProcessStatus.Value = value; } }
public Int32 _ProcessStatusBy { get { return Cols._ProcessStatusBy.Value; } set { Cols._ProcessStatusBy.Value = value; } }
public DateTime _ProcessStatusAt { get { return Cols._ProcessStatusAt.Value; } set { Cols._ProcessStatusAt.Value = value; } }
public Int32? _ProcessStatusBy { get { return Cols._ProcessStatusBy.Value; } set { Cols._ProcessStatusBy.Value = value; } }
public DateTime? _ProcessStatusAt { get { return Cols._ProcessStatusAt.Value; } set { Cols._ProcessStatusAt.Value = value; } }
public String _ItemStatus { get { return Cols._ItemStatus.Value; } set { Cols._ItemStatus.Value = value; } }
public Int32 _ItemStatusBy { get { return Cols._ItemStatusBy.Value; } set { Cols._ItemStatusBy.Value = value; } }
public DateTime _ItemStatusAt { get { return Cols._ItemStatusAt.Value; } set { Cols._ItemStatusAt.Value = value; } }
public Int32? _ItemStatusBy { get { return Cols._ItemStatusBy.Value; } set { Cols._ItemStatusBy.Value = value; } }
public DateTime? _ItemStatusAt { get { return Cols._ItemStatusAt.Value; } set { Cols._ItemStatusAt.Value = value; } }
public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
public Int16? _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
public DateTime? _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
public Int32? _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
public DateTime? _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
public Int32? _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
// Existing columns - confirmed on database if table exists.
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
public List<String> UpdatableColumns { get { return ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList(); } }
//-------------------------------------------------------------------
// Population.
@@ -149,18 +169,18 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
_ItemType = GetFieldInt16(dbDataReader, "ItemType", _ItemType);
_ItemId = GetFieldInt32(dbDataReader, "ItemId", _ItemId);
_ProcessStatus = GetFieldString(dbDataReader, "ProcessStatus", _ProcessStatus);
_ProcessStatusBy = GetFieldInt32(dbDataReader, "ProcessStatusBy", _ProcessStatusBy);
_ProcessStatusAt = GetFieldDateTime(dbDataReader, "ProcessStatusAt", _ProcessStatusAt);
_ProcessStatusBy = GetFieldInt32Nullable(dbDataReader, "ProcessStatusBy", _ProcessStatusBy);
_ProcessStatusAt = GetFieldDateTimeNullable(dbDataReader, "ProcessStatusAt", _ProcessStatusAt);
_ItemStatus = GetFieldString(dbDataReader, "ItemStatus", _ItemStatus);
_ItemStatusBy = GetFieldInt32(dbDataReader, "ItemStatusBy", _ItemStatusBy);
_ItemStatusAt = GetFieldDateTime(dbDataReader, "ItemStatusAt", _ItemStatusAt);
_ItemStatusBy = GetFieldInt32Nullable(dbDataReader, "ItemStatusBy", _ItemStatusBy);
_ItemStatusAt = GetFieldDateTimeNullable(dbDataReader, "ItemStatusAt", _ItemStatusAt);
_Notes = GetFieldString(dbDataReader, "Notes", _Notes);
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
_CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
_Flags = GetFieldInt16Nullable(dbDataReader, "Flags", _Flags);
_CreateOn = GetFieldDateTimeNullable(dbDataReader, "CreateOn", _CreateOn);
_CreateBy = GetFieldInt32Nullable(dbDataReader, "CreateBy", _CreateBy);
_CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
_UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
_UpdateOn = GetFieldDateTimeNullable(dbDataReader, "UpdateOn", _UpdateOn);
_UpdateBy = GetFieldInt32Nullable(dbDataReader, "UpdateBy", _UpdateBy);
_UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
}
@@ -212,10 +232,15 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
//-------------------------------------------------------------------
// Update command.
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
public override bool ExecuteUpdateCommand (DbCommand dbCommand, List<String> columnsToUpdate = null)
{
// Columns to update.
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
List<String> columnNames = (columnsToUpdate?.Any() ?? false ? columnsToUpdate : UpdatableColumns).Where(col => UpdatableColumns.ContainsCI(col)).ToList();
if (!columnNames.Any())
{
SaLogger.Warn($"{SysUtil.Fn} No columns to update. [{GetType().Name}]");
return false;
}
// Construct query.
String query = "UPDATE " + TableNameFmt + " SET ";
if (dbCommand is SqlCommand)
@@ -1,15 +1,16 @@
using Microsoft.Data.SqlClient;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Dbas.Data;
using System;
using System.Collections.Generic;
using System.Data.Common;
using Microsoft.Data.SqlClient;
using System.Linq;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:58
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:13
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
{
@@ -22,19 +23,19 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
public ColumnDataInt32 _ProcessId { get; } = new ColumnDataInt32("ProcessId");
public ColumnDataInt32 _InterfaceDataItemId { get; } = new ColumnDataInt32("InterfaceDataItemId");
public ColumnDataString _ItemData { get; } = new ColumnDataString("ItemData");
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
public ColumnDataInt16Nullable _Flags { get; } = new ColumnDataInt16Nullable("Flags");
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
public ColumnDataDateTimeNullable _CreateOn { get; } = new ColumnDataDateTimeNullable("CreateOn");
public ColumnDataInt32Nullable _CreateBy { get; } = new ColumnDataInt32Nullable("CreateBy");
public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
public ColumnDataDateTimeNullable _UpdateOn { get; } = new ColumnDataDateTimeNullable("UpdateOn");
public ColumnDataInt32Nullable _UpdateBy { get; } = new ColumnDataInt32Nullable("UpdateBy");
public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
}
//-------------------------------------------------------------------
// Data members.
private static List<String> fields { get; } = new List<String>()
protected static List<String> fields { get; } = new List<String>()
{
"ProcessId",
"InterfaceDataItemId",
@@ -48,15 +49,27 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
"UpdateBy",
"UpdateHost",
};
private static List<String> fieldsId { get; } = new List<String>()
protected static List<String> fieldsId { get; } = new List<String>()
{
};
private static List<String> fieldsPrimary { get; } = new List<String>()
protected static List<String> fieldsPrimary { get; } = new List<String>()
{
"ProcessId",
"InterfaceDataItemId",
};
private static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
protected static List<String> fieldsNullable { get; } = new List<String>()
{
"ItemData",
"Flags",
"Status",
"CreateOn",
"CreateBy",
"CreateHost",
"UpdateOn",
"UpdateBy",
"UpdateHost",
};
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
{
"CreateOn",
"CreateBy",
@@ -92,17 +105,18 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
public Int32 _ProcessId { get { return Cols._ProcessId.Value; } set { Cols._ProcessId.Value = value; } }
public Int32 _InterfaceDataItemId { get { return Cols._InterfaceDataItemId.Value; } set { Cols._InterfaceDataItemId.Value = value; } }
public String _ItemData { get { return Cols._ItemData.Value; } set { Cols._ItemData.Value = value; } }
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
public Int16? _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
public DateTime? _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
public Int32? _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
public DateTime? _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
public Int32? _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
// Existing columns - confirmed on database if table exists.
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
public List<String> UpdatableColumns { get { return ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList(); } }
//-------------------------------------------------------------------
// Population.
@@ -124,13 +138,13 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
_ProcessId = GetFieldInt32(dbDataReader, "ProcessId", _ProcessId);
_InterfaceDataItemId = GetFieldInt32(dbDataReader, "InterfaceDataItemId", _InterfaceDataItemId);
_ItemData = GetFieldString(dbDataReader, "ItemData", _ItemData);
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
_Flags = GetFieldInt16Nullable(dbDataReader, "Flags", _Flags);
_Status = GetFieldString(dbDataReader, "Status", _Status);
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
_CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
_CreateOn = GetFieldDateTimeNullable(dbDataReader, "CreateOn", _CreateOn);
_CreateBy = GetFieldInt32Nullable(dbDataReader, "CreateBy", _CreateBy);
_CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
_UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
_UpdateOn = GetFieldDateTimeNullable(dbDataReader, "UpdateOn", _UpdateOn);
_UpdateBy = GetFieldInt32Nullable(dbDataReader, "UpdateBy", _UpdateBy);
_UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
}
@@ -173,10 +187,15 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
//-------------------------------------------------------------------
// Update command.
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
public override bool ExecuteUpdateCommand (DbCommand dbCommand, List<String> columnsToUpdate = null)
{
// Columns to update.
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
List<String> columnNames = (columnsToUpdate?.Any() ?? false ? columnsToUpdate : UpdatableColumns).Where(col => UpdatableColumns.ContainsCI(col)).ToList();
if (!columnNames.Any())
{
SaLogger.Warn($"{SysUtil.Fn} No columns to update. [{GetType().Name}]");
return false;
}
// Construct query.
String query = "UPDATE " + TableNameFmt + " SET ";
if (dbCommand is SqlCommand)
@@ -1,15 +1,16 @@
using Microsoft.Data.SqlClient;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Dbas.Data;
using System;
using System.Collections.Generic;
using System.Data.Common;
using Microsoft.Data.SqlClient;
using System.Linq;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:58
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:13
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
{
@@ -24,22 +25,22 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
public ColumnDataString _MsgType { get; } = new ColumnDataString("MsgType");
public ColumnDataString _Msg { get; } = new ColumnDataString("Msg");
public ColumnDataString _FileName { get; } = new ColumnDataString("FileName");
public ColumnDataInt32 _LineNumber { get; } = new ColumnDataInt32("LineNumber");
public ColumnDataInt16 _ItemType { get; } = new ColumnDataInt16("ItemType");
public ColumnDataInt32 _ItemId { get; } = new ColumnDataInt32("ItemId");
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
public ColumnDataInt32Nullable _LineNumber { get; } = new ColumnDataInt32Nullable("LineNumber");
public ColumnDataInt16Nullable _ItemType { get; } = new ColumnDataInt16Nullable("ItemType");
public ColumnDataInt32Nullable _ItemId { get; } = new ColumnDataInt32Nullable("ItemId");
public ColumnDataInt16Nullable _Flags { get; } = new ColumnDataInt16Nullable("Flags");
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
public ColumnDataDateTimeNullable _CreateOn { get; } = new ColumnDataDateTimeNullable("CreateOn");
public ColumnDataInt32Nullable _CreateBy { get; } = new ColumnDataInt32Nullable("CreateBy");
public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
public ColumnDataDateTimeNullable _UpdateOn { get; } = new ColumnDataDateTimeNullable("UpdateOn");
public ColumnDataInt32Nullable _UpdateBy { get; } = new ColumnDataInt32Nullable("UpdateBy");
public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
}
//-------------------------------------------------------------------
// Data members.
private static List<String> fields { get; } = new List<String>()
protected static List<String> fields { get; } = new List<String>()
{
"Id",
"ProcessId",
@@ -58,14 +59,31 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
"UpdateBy",
"UpdateHost",
};
private static List<String> fieldsId { get; } = new List<String>()
protected static List<String> fieldsId { get; } = new List<String>()
{
};
private static List<String> fieldsPrimary { get; } = new List<String>()
protected static List<String> fieldsPrimary { get; } = new List<String>()
{
"Id",
};
private static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
protected static List<String> fieldsNullable { get; } = new List<String>()
{
"MsgType",
"Msg",
"FileName",
"LineNumber",
"ItemType",
"ItemId",
"Flags",
"Status",
"CreateOn",
"CreateBy",
"CreateHost",
"UpdateOn",
"UpdateBy",
"UpdateHost",
};
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
{
"CreateOn",
"CreateBy",
@@ -102,20 +120,21 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
public String _MsgType { get { return Cols._MsgType.Value; } set { Cols._MsgType.Value = value; } }
public String _Msg { get { return Cols._Msg.Value; } set { Cols._Msg.Value = value; } }
public String _FileName { get { return Cols._FileName.Value; } set { Cols._FileName.Value = value; } }
public Int32 _LineNumber { get { return Cols._LineNumber.Value; } set { Cols._LineNumber.Value = value; } }
public Int16 _ItemType { get { return Cols._ItemType.Value; } set { Cols._ItemType.Value = value; } }
public Int32 _ItemId { get { return Cols._ItemId.Value; } set { Cols._ItemId.Value = value; } }
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
public Int32? _LineNumber { get { return Cols._LineNumber.Value; } set { Cols._LineNumber.Value = value; } }
public Int16? _ItemType { get { return Cols._ItemType.Value; } set { Cols._ItemType.Value = value; } }
public Int32? _ItemId { get { return Cols._ItemId.Value; } set { Cols._ItemId.Value = value; } }
public Int16? _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
public DateTime? _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
public Int32? _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
public DateTime? _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
public Int32? _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
// Existing columns - confirmed on database if table exists.
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
public List<String> UpdatableColumns { get { return ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList(); } }
//-------------------------------------------------------------------
// Population.
@@ -139,16 +158,16 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
_MsgType = GetFieldString(dbDataReader, "MsgType", _MsgType);
_Msg = GetFieldString(dbDataReader, "Msg", _Msg);
_FileName = GetFieldString(dbDataReader, "FileName", _FileName);
_LineNumber = GetFieldInt32(dbDataReader, "LineNumber", _LineNumber);
_ItemType = GetFieldInt16(dbDataReader, "ItemType", _ItemType);
_ItemId = GetFieldInt32(dbDataReader, "ItemId", _ItemId);
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
_LineNumber = GetFieldInt32Nullable(dbDataReader, "LineNumber", _LineNumber);
_ItemType = GetFieldInt16Nullable(dbDataReader, "ItemType", _ItemType);
_ItemId = GetFieldInt32Nullable(dbDataReader, "ItemId", _ItemId);
_Flags = GetFieldInt16Nullable(dbDataReader, "Flags", _Flags);
_Status = GetFieldString(dbDataReader, "Status", _Status);
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
_CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
_CreateOn = GetFieldDateTimeNullable(dbDataReader, "CreateOn", _CreateOn);
_CreateBy = GetFieldInt32Nullable(dbDataReader, "CreateBy", _CreateBy);
_CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
_UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
_UpdateOn = GetFieldDateTimeNullable(dbDataReader, "UpdateOn", _UpdateOn);
_UpdateBy = GetFieldInt32Nullable(dbDataReader, "UpdateBy", _UpdateBy);
_UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
}
@@ -196,10 +215,15 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
//-------------------------------------------------------------------
// Update command.
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
public override bool ExecuteUpdateCommand (DbCommand dbCommand, List<String> columnsToUpdate = null)
{
// Columns to update.
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
List<String> columnNames = (columnsToUpdate?.Any() ?? false ? columnsToUpdate : UpdatableColumns).Where(col => UpdatableColumns.ContainsCI(col)).ToList();
if (!columnNames.Any())
{
SaLogger.Warn($"{SysUtil.Fn} No columns to update. [{GetType().Name}]");
return false;
}
// Construct query.
String query = "UPDATE " + TableNameFmt + " SET ";
if (dbCommand is SqlCommand)
@@ -1,15 +1,16 @@
using Microsoft.Data.SqlClient;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Dbas.Data;
using System;
using System.Collections.Generic;
using System.Data.Common;
using Microsoft.Data.SqlClient;
using System.Linq;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:58
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:13
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
{
@@ -23,18 +24,18 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
public ColumnDataInt32 _InterfaceId { get; } = new ColumnDataInt32("InterfaceId");
public ColumnDataInt16 _Direction { get; } = new ColumnDataInt16("Direction");
public ColumnDataString _ProcRef { get; } = new ColumnDataString("ProcRef");
public ColumnDataInt32 _ProcSeq { get; } = new ColumnDataInt32("ProcSeq");
public ColumnDataDateTime _ProcessAt { get; } = new ColumnDataDateTime("ProcessAt");
public ColumnDataDateTime _BatchAt { get; } = new ColumnDataDateTime("BatchAt");
public ColumnDataInt32 _ElapseSecs { get; } = new ColumnDataInt32("ElapseSecs");
public ColumnDataInt32 _ItemCount { get; } = new ColumnDataInt32("ItemCount");
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
public ColumnDataInt32Nullable _ProcSeq { get; } = new ColumnDataInt32Nullable("ProcSeq");
public ColumnDataDateTimeNullable _ProcessAt { get; } = new ColumnDataDateTimeNullable("ProcessAt");
public ColumnDataDateTimeNullable _BatchAt { get; } = new ColumnDataDateTimeNullable("BatchAt");
public ColumnDataInt32Nullable _ElapseSecs { get; } = new ColumnDataInt32Nullable("ElapseSecs");
public ColumnDataInt32Nullable _ItemCount { get; } = new ColumnDataInt32Nullable("ItemCount");
public ColumnDataInt16Nullable _Flags { get; } = new ColumnDataInt16Nullable("Flags");
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
public ColumnDataDateTimeNullable _CreateOn { get; } = new ColumnDataDateTimeNullable("CreateOn");
public ColumnDataInt32Nullable _CreateBy { get; } = new ColumnDataInt32Nullable("CreateBy");
public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
public ColumnDataDateTimeNullable _UpdateOn { get; } = new ColumnDataDateTimeNullable("UpdateOn");
public ColumnDataInt32Nullable _UpdateBy { get; } = new ColumnDataInt32Nullable("UpdateBy");
public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
}
@@ -67,6 +68,23 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
{
"Id",
};
protected static List<String> fieldsNullable { get; } = new List<String>()
{
"ProcRef",
"ProcSeq",
"ProcessAt",
"BatchAt",
"ElapseSecs",
"ItemCount",
"Flags",
"Status",
"CreateOn",
"CreateBy",
"CreateHost",
"UpdateOn",
"UpdateBy",
"UpdateHost",
};
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
{
"CreateOn",
@@ -102,22 +120,23 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
public Int32 _InterfaceId { get { return Cols._InterfaceId.Value; } set { Cols._InterfaceId.Value = value; } }
public Int16 _Direction { get { return Cols._Direction.Value; } set { Cols._Direction.Value = value; } }
public String _ProcRef { get { return Cols._ProcRef.Value; } set { Cols._ProcRef.Value = value; } }
public Int32 _ProcSeq { get { return Cols._ProcSeq.Value; } set { Cols._ProcSeq.Value = value; } }
public DateTime _ProcessAt { get { return Cols._ProcessAt.Value; } set { Cols._ProcessAt.Value = value; } }
public DateTime _BatchAt { get { return Cols._BatchAt.Value; } set { Cols._BatchAt.Value = value; } }
public Int32 _ElapseSecs { get { return Cols._ElapseSecs.Value; } set { Cols._ElapseSecs.Value = value; } }
public Int32 _ItemCount { get { return Cols._ItemCount.Value; } set { Cols._ItemCount.Value = value; } }
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
public Int32? _ProcSeq { get { return Cols._ProcSeq.Value; } set { Cols._ProcSeq.Value = value; } }
public DateTime? _ProcessAt { get { return Cols._ProcessAt.Value; } set { Cols._ProcessAt.Value = value; } }
public DateTime? _BatchAt { get { return Cols._BatchAt.Value; } set { Cols._BatchAt.Value = value; } }
public Int32? _ElapseSecs { get { return Cols._ElapseSecs.Value; } set { Cols._ElapseSecs.Value = value; } }
public Int32? _ItemCount { get { return Cols._ItemCount.Value; } set { Cols._ItemCount.Value = value; } }
public Int16? _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
public DateTime? _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
public Int32? _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
public DateTime? _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
public Int32? _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
// Existing columns - confirmed on database if table exists.
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
public List<String> UpdatableColumns { get { return ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList(); } }
//-------------------------------------------------------------------
// Population.
@@ -140,18 +159,18 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
_InterfaceId = GetFieldInt32(dbDataReader, "InterfaceId", _InterfaceId);
_Direction = GetFieldInt16(dbDataReader, "Direction", _Direction);
_ProcRef = GetFieldString(dbDataReader, "ProcRef", _ProcRef);
_ProcSeq = GetFieldInt32(dbDataReader, "ProcSeq", _ProcSeq);
_ProcessAt = GetFieldDateTime(dbDataReader, "ProcessAt", _ProcessAt);
_BatchAt = GetFieldDateTime(dbDataReader, "BatchAt", _BatchAt);
_ElapseSecs = GetFieldInt32(dbDataReader, "ElapseSecs", _ElapseSecs);
_ItemCount = GetFieldInt32(dbDataReader, "ItemCount", _ItemCount);
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
_ProcSeq = GetFieldInt32Nullable(dbDataReader, "ProcSeq", _ProcSeq);
_ProcessAt = GetFieldDateTimeNullable(dbDataReader, "ProcessAt", _ProcessAt);
_BatchAt = GetFieldDateTimeNullable(dbDataReader, "BatchAt", _BatchAt);
_ElapseSecs = GetFieldInt32Nullable(dbDataReader, "ElapseSecs", _ElapseSecs);
_ItemCount = GetFieldInt32Nullable(dbDataReader, "ItemCount", _ItemCount);
_Flags = GetFieldInt16Nullable(dbDataReader, "Flags", _Flags);
_Status = GetFieldString(dbDataReader, "Status", _Status);
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
_CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
_CreateOn = GetFieldDateTimeNullable(dbDataReader, "CreateOn", _CreateOn);
_CreateBy = GetFieldInt32Nullable(dbDataReader, "CreateBy", _CreateBy);
_CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
_UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
_UpdateOn = GetFieldDateTimeNullable(dbDataReader, "UpdateOn", _UpdateOn);
_UpdateBy = GetFieldInt32Nullable(dbDataReader, "UpdateBy", _UpdateBy);
_UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
}
@@ -200,10 +219,15 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
//-------------------------------------------------------------------
// Update command.
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
public override bool ExecuteUpdateCommand (DbCommand dbCommand, List<String> columnsToUpdate = null)
{
// Columns to update.
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
List<String> columnNames = (columnsToUpdate?.Any() ?? false ? columnsToUpdate : UpdatableColumns).Where(col => UpdatableColumns.ContainsCI(col)).ToList();
if (!columnNames.Any())
{
SaLogger.Warn($"{SysUtil.Fn} No columns to update. [{GetType().Name}]");
return false;
}
// Construct query.
String query = "UPDATE " + TableNameFmt + " SET ";
if (dbCommand is SqlCommand)
@@ -1,15 +1,16 @@
using Microsoft.Data.SqlClient;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Dbas.Data;
using System;
using System.Collections.Generic;
using System.Data.Common;
using Microsoft.Data.SqlClient;
using System.Linq;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Utils;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:58
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:13
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
{
@@ -22,23 +23,23 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
public ColumnDataInt32 _Id { get; } = new ColumnDataInt32("Id");
public ColumnDataString _Context { get; } = new ColumnDataString("Context");
public ColumnDataString _Code { get; } = new ColumnDataString("Code");
public ColumnDataInt16 _Category { get; } = new ColumnDataInt16("Category");
public ColumnDataInt16 _Type { get; } = new ColumnDataInt16("Type");
public ColumnDataInt16Nullable _Category { get; } = new ColumnDataInt16Nullable("Category");
public ColumnDataInt16Nullable _Type { get; } = new ColumnDataInt16Nullable("Type");
public ColumnDataString _Caption { get; } = new ColumnDataString("Caption");
public ColumnDataString _Notes { get; } = new ColumnDataString("Notes");
public ColumnDataInt16 _Flags { get; } = new ColumnDataInt16("Flags");
public ColumnDataInt16Nullable _Flags { get; } = new ColumnDataInt16Nullable("Flags");
public ColumnDataString _Status { get; } = new ColumnDataString("Status");
public ColumnDataDateTime _CreateOn { get; } = new ColumnDataDateTime("CreateOn");
public ColumnDataInt32 _CreateBy { get; } = new ColumnDataInt32("CreateBy");
public ColumnDataDateTimeNullable _CreateOn { get; } = new ColumnDataDateTimeNullable("CreateOn");
public ColumnDataInt32Nullable _CreateBy { get; } = new ColumnDataInt32Nullable("CreateBy");
public ColumnDataString _CreateHost { get; } = new ColumnDataString("CreateHost");
public ColumnDataDateTime _UpdateOn { get; } = new ColumnDataDateTime("UpdateOn");
public ColumnDataInt32 _UpdateBy { get; } = new ColumnDataInt32("UpdateBy");
public ColumnDataDateTimeNullable _UpdateOn { get; } = new ColumnDataDateTimeNullable("UpdateOn");
public ColumnDataInt32Nullable _UpdateBy { get; } = new ColumnDataInt32Nullable("UpdateBy");
public ColumnDataString _UpdateHost { get; } = new ColumnDataString("UpdateHost");
}
//-------------------------------------------------------------------
// Data members.
private static List<String> fields { get; } = new List<String>()
protected static List<String> fields { get; } = new List<String>()
{
"Id",
"Context",
@@ -56,14 +57,29 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
"UpdateBy",
"UpdateHost",
};
private static List<String> fieldsId { get; } = new List<String>()
protected static List<String> fieldsId { get; } = new List<String>()
{
};
private static List<String> fieldsPrimary { get; } = new List<String>()
protected static List<String> fieldsPrimary { get; } = new List<String>()
{
"Id",
};
private static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
protected static List<String> fieldsNullable { get; } = new List<String>()
{
"Context",
"Category",
"Type",
"Notes",
"Flags",
"Status",
"CreateOn",
"CreateBy",
"CreateHost",
"UpdateOn",
"UpdateBy",
"UpdateHost",
};
protected static List<String> fieldsIgnoreOnUpdate { get; } = new List<String>()
{
"CreateOn",
"CreateBy",
@@ -93,21 +109,22 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
public Int32 _Id { get { return Cols._Id.Value; } set { Cols._Id.Value = value; } }
public String _Context { get { return Cols._Context.Value; } set { Cols._Context.Value = value; } }
public String _Code { get { return Cols._Code.Value; } set { Cols._Code.Value = value; } }
public Int16 _Category { get { return Cols._Category.Value; } set { Cols._Category.Value = value; } }
public Int16 _Type { get { return Cols._Type.Value; } set { Cols._Type.Value = value; } }
public Int16? _Category { get { return Cols._Category.Value; } set { Cols._Category.Value = value; } }
public Int16? _Type { get { return Cols._Type.Value; } set { Cols._Type.Value = value; } }
public String _Caption { get { return Cols._Caption.Value; } set { Cols._Caption.Value = value; } }
public String _Notes { get { return Cols._Notes.Value; } set { Cols._Notes.Value = value; } }
public Int16 _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
public Int16? _Flags { get { return Cols._Flags.Value; } set { Cols._Flags.Value = value; } }
public String _Status { get { return Cols._Status.Value; } set { Cols._Status.Value = value; } }
public DateTime _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
public Int32 _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
public DateTime? _CreateOn { get { return Cols._CreateOn.Value; } set { Cols._CreateOn.Value = value; } }
public Int32? _CreateBy { get { return Cols._CreateBy.Value; } set { Cols._CreateBy.Value = value; } }
public String _CreateHost { get { return Cols._CreateHost.Value; } set { Cols._CreateHost.Value = value; } }
public DateTime _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
public Int32 _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
public DateTime? _UpdateOn { get { return Cols._UpdateOn.Value; } set { Cols._UpdateOn.Value = value; } }
public Int32? _UpdateBy { get { return Cols._UpdateBy.Value; } set { Cols._UpdateBy.Value = value; } }
public String _UpdateHost { get { return Cols._UpdateHost.Value; } set { Cols._UpdateHost.Value = value; } }
// Existing columns - confirmed on database if table exists.
public List<String> ExistingColumnNames { get { return GetExistingColumnNames(Fields); } }
public List<String> ExistingColumnNamesNonId { get { return GetExistingColumnNames(FieldsNonId); } }
public List<String> UpdatableColumns { get { return ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList(); } }
//-------------------------------------------------------------------
// Population.
@@ -129,17 +146,17 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
_Id = GetFieldInt32(dbDataReader, "Id", _Id);
_Context = GetFieldString(dbDataReader, "Context", _Context);
_Code = GetFieldString(dbDataReader, "Code", _Code);
_Category = GetFieldInt16(dbDataReader, "Category", _Category);
_Type = GetFieldInt16(dbDataReader, "Type", _Type);
_Category = GetFieldInt16Nullable(dbDataReader, "Category", _Category);
_Type = GetFieldInt16Nullable(dbDataReader, "Type", _Type);
_Caption = GetFieldString(dbDataReader, "Caption", _Caption);
_Notes = GetFieldString(dbDataReader, "Notes", _Notes);
_Flags = GetFieldInt16(dbDataReader, "Flags", _Flags);
_Flags = GetFieldInt16Nullable(dbDataReader, "Flags", _Flags);
_Status = GetFieldString(dbDataReader, "Status", _Status);
_CreateOn = GetFieldDateTime(dbDataReader, "CreateOn", _CreateOn);
_CreateBy = GetFieldInt32(dbDataReader, "CreateBy", _CreateBy);
_CreateOn = GetFieldDateTimeNullable(dbDataReader, "CreateOn", _CreateOn);
_CreateBy = GetFieldInt32Nullable(dbDataReader, "CreateBy", _CreateBy);
_CreateHost = GetFieldString(dbDataReader, "CreateHost", _CreateHost);
_UpdateOn = GetFieldDateTime(dbDataReader, "UpdateOn", _UpdateOn);
_UpdateBy = GetFieldInt32(dbDataReader, "UpdateBy", _UpdateBy);
_UpdateOn = GetFieldDateTimeNullable(dbDataReader, "UpdateOn", _UpdateOn);
_UpdateBy = GetFieldInt32Nullable(dbDataReader, "UpdateBy", _UpdateBy);
_UpdateHost = GetFieldString(dbDataReader, "UpdateHost", _UpdateHost);
}
@@ -186,10 +203,15 @@ namespace Sarand.Net.Standard.Dbas.Interfaces.Internal
//-------------------------------------------------------------------
// Update command.
public override bool ExecuteUpdateCommand (DbCommand dbCommand)
public override bool ExecuteUpdateCommand (DbCommand dbCommand, List<String> columnsToUpdate = null)
{
// Columns to update.
List<String> columnNames = ExistingColumnNamesNonId.Where(item => !fieldsPrimary.ContainsCI(item) && !fieldsIgnoreOnUpdate.ContainsCI(item)).ToList();
List<String> columnNames = (columnsToUpdate?.Any() ?? false ? columnsToUpdate : UpdatableColumns).Where(col => UpdatableColumns.ContainsCI(col)).ToList();
if (!columnNames.Any())
{
SaLogger.Warn($"{SysUtil.Fn} No columns to update. [{GetType().Name}]");
return false;
}
// Construct query.
String query = "UPDATE " + TableNameFmt + " SET ";
if (dbCommand is SqlCommand)
@@ -1,11 +1,10 @@
using System;
using System.Collections.Generic;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Interfaces;
using Sarand.Net.Standard.Dbas.Base;
using Sarand.Net.Standard.Base.Utils;
using System;
using System.Collections.Generic;
namespace Sarand.Net.Standard.Dbas.Interfaces
{
@@ -75,6 +74,14 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
}
return interfaceObj.Id;
}
public override bool UpdateInterface(SaInterface interfaceObj, DbUpdateInfo dbUpdateInfo)
{
ClearErrorState();
if (!interfaceMgr.UpdateInterface(interfaceObj, dbUpdateInfo))
return SetErrorState(interfaceMgr.ErrorStateMessage);
return true;
}
// Clear configuration options, data items, processes etc.
public override bool ClearDependentData(SaInterface interfaceObj, DbUpdateInfo dbUpdateInfo)
{
@@ -93,10 +100,26 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
{
return interfaceMgr.GetInterfaceById(interfaceId);
}
public override ColumnDfn GetInterfaceColumnDfn(SaInterface.Column columnId, string caption = "", int width = 0)
{
return interfaceMgr.GetInterfaceColumnDfn(columnId, caption, width);
}
public override long GetInterfaceCount(SaInterface.Params prmInterface)
{
return interfaceMgr.GetInterfaceCount(prmInterface);
}
public override List<SaInterface> GetInterfaceList(SaInterface.Params prmInterface)
{
return interfaceMgr.GetInterfaceList(prmInterface);
}
public override DbResultSet ExecuteInterfaceQuery(List<ColumnDfn> columns, SaInterface.Params prm)
{
return interfaceMgr.ExecuteInterfaceQuery(columns, prm);
}
public override DataValue GetInterfaceDataValue(ColumnDfn column, NamedValue.Map values)
{
return interfaceMgr.GetInterfaceDataValue(column, values);
}
//---------------------------------------------------------------
// Conversion between Interface Category & Type and the equivalent database Id (if only one exists).
@@ -1,11 +1,11 @@
using System;
using System.IO;
using System.Reflection;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.IO;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Dbas.Base;
using System;
using System.IO;
using System.Reflection;
namespace Sarand.Net.Standard.Dbas.Interface
{
@@ -14,8 +14,7 @@ namespace Sarand.Net.Standard.Dbas.Interface
{
//-------------------------------------------------------------------
// Data members.
//private static string messageBoxTitle = "Sarand Interface Module database definition generator";
//private static String dbConnectionString = "Driver={SQL Server Native Client 11.0};Server=Sarand106\\SQL2014;Database=SaStockTracker_Solent_STN;Trusted_Connection=Yes;MARS_Connection=yes;";
private static String className = nameof(SaInterfaceDbDfnGenerator);
//-------------------------------------------------------------------
/// <summary>
@@ -23,7 +22,7 @@ namespace Sarand.Net.Standard.Dbas.Interface
/// </summary>
public static bool Generate(String connectionString)
{
String fn = nameof(SaInterfaceDbDfnGenerator) + ".Generate";
String fn = $"{className}.Generate";
// Locate output folder:
String directory = GetOutputFolder();
@@ -42,7 +41,7 @@ namespace Sarand.Net.Standard.Dbas.Interface
}
catch (Exception exc)
{
SaLogger.Error(fn + " " + ExceptionUtil.GetLogMessage(exc));
SaLogger.Error($"{fn} {ExceptionUtil.GetLogMessage(exc, "generating Interface database definition")}");
}
return false;
}
@@ -73,10 +72,19 @@ namespace Sarand.Net.Standard.Dbas.Interface
config.Schema.InsertOnlyColumns.Add("SaInterfaceDataItem", "InterfaceId");
config.Schema.InsertOnlyColumns.Add("SaInterfaceProcessDataItem", "ProcessId,InterfaceDataItemId");
// Database Definition class.
config.DefinitionClass.Usings.Clear();
config.DefinitionClass.Usings.Add("Sarand.Net.Standard.Base.Core");
config.DefinitionClass.Usings.Add("Sarand.Net.Standard.Base.Utils");
config.DefinitionClass.Usings.Add("Sarand.Net.Standard.Base.Dbas");
config.DefinitionClass.Namespace = "Sarand.Net.Standard.Base.Interfaces";
config.DefinitionClass.Classname = "SaInterfaceDbDfn";
// Table class.
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.App");
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Core");
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Utils");
config.TableClass.Usings.Add("Sarand.Net.Standard.Base.Dbas");
config.TableClass.Namespace = "Sarand.Net.Standard.Dbas.Interfaces.Internal";
config.TableClass.ClassName_DatabaseInfo = "IDatabaseInfo";
config.TableClass.MandatoryConstructorDbInfo = true;
// Generate database definition.
@@ -86,7 +94,7 @@ namespace Sarand.Net.Standard.Dbas.Interface
//-------------------------------------------------------------------
private static String GetOutputFolder()
{
String fn = nameof(SaInterfaceDbDfnGenerator) + ".GetOutputFolder";
String fn = $"{className}.GetOutputFolder";
String assemblyDirectory = FileUtil.GetParentDirectory((Assembly.GetAssembly(typeof(DatabaseDefinitionGenerator)).Location));
String directory = assemblyDirectory;
SaLogger.Debug(fn + " Assembly folder: " + directory);
@@ -106,11 +114,11 @@ namespace Sarand.Net.Standard.Dbas.Interface
return String.Empty;
}
// Code files are generated to '..\Dbas\Generated\Interfaces\' folder.
directory += Path.DirectorySeparatorChar + "Database" + Path.DirectorySeparatorChar + "Generated" + Path.DirectorySeparatorChar + "Interfaces";
SaLogger.Debug(fn + " Output folder: " + directory);
directory = Path.Combine(directory, "Database", "Generated", "Interfaces");
SaLogger.Debug($"{fn} Output folder: {directory}");
if (!FileUtil.ValidateDirectory(directory, true))
{
SaLogger.Error(fn + " Output folder not found:\n\n" + directory);
SaLogger.Error($"{fn} Output folder not found: {directory}");
return String.Empty;
}
return directory;
@@ -1,15 +1,15 @@
using System;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Interfaces;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Dbas.Data;
using Sarand.Net.Standard.Dbas.Interfaces.Internal;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Interfaces;
using Sarand.Net.Standard.Dbas.Data;
using Sarand.Net.Standard.Dbas.Interfaces.Internal;
using Sarand.Net.Standard.Base.Utils;
namespace Sarand.Net.Standard.Dbas.Interfaces
{
@@ -212,7 +212,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
interfaceProcessMessage.Level = SaMessageLevel.Warning;
interfaceProcessMessage.Message = dbInterfaceProcessMessage._Msg;
interfaceProcessMessage.Filename = dbInterfaceProcessMessage._FileName;
interfaceProcessMessage.LineNumber = dbInterfaceProcessMessage._LineNumber;
interfaceProcessMessage.LineNumber = dbInterfaceProcessMessage._LineNumber ?? 0;
interfaceProcessMessage.ItemId = new ItemId(dbInterfaceProcessMessage._ItemType, new SysId(dbInterfaceProcessMessage._ItemId));
interfaceProcessMessage.Status = SacsSystem.GetStatusForCode(dbInterfaceProcessMessage._Status);
interfaceProcessMessage.SetCreateStamp(dbInterfaceProcessMessage._CreateOn, new SysId(dbInterfaceProcessMessage._CreateBy), dbInterfaceProcessMessage._CreateHost);
@@ -1,15 +1,15 @@
using System;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Interfaces;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Dbas.Data;
using Sarand.Net.Standard.Dbas.Interfaces.Internal;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Interfaces;
using Sarand.Net.Standard.Dbas.Data;
using Sarand.Net.Standard.Dbas.Interfaces.Internal;
using Sarand.Net.Standard.Base.Utils;
namespace Sarand.Net.Standard.Dbas.Interfaces
{
@@ -49,7 +49,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
private SaInterfaceProcess CreateInterfaceProcess(SaInterfaceProcess_Db dbInterfaceProcess)
{
ClearErrorState();
SaInterfaceProcess interfaceProcess = new SaInterfaceProcess_Dbas(new SysId(dbInterfaceProcess._Id), new SysId(dbInterfaceProcess._InterfaceId), (SaInterfaceProcessDirection)dbInterfaceProcess._Direction, dbInterfaceProcess._ProcRef, dbInterfaceProcess._ProcSeq, (ushort)dbInterfaceProcess._Flags);
SaInterfaceProcess interfaceProcess = new SaInterfaceProcess_Dbas(new SysId(dbInterfaceProcess._Id), new SysId(dbInterfaceProcess._InterfaceId), (SaInterfaceProcessDirection)dbInterfaceProcess._Direction, dbInterfaceProcess._ProcRef, dbInterfaceProcess._ProcSeq ?? 0, (ushort)dbInterfaceProcess._Flags);
PopulateFrom(dbInterfaceProcess, interfaceProcess);
return interfaceProcess;
}
@@ -284,7 +284,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
//interfaceProcess.Sequence = dbInterfaceProcess._ProcSeq;
interfaceProcess.ProcessAt = dbInterfaceProcess._ProcessAt;
interfaceProcess.BatchAt = dbInterfaceProcess._BatchAt;
interfaceProcess.ElapseSecs = dbInterfaceProcess._ElapseSecs;
interfaceProcess.ElapseSecs = dbInterfaceProcess._ElapseSecs ?? 0;
interfaceProcess.Status = SacsSystem.GetStatusForCode(dbInterfaceProcess._Status);
interfaceProcess.SetCreateStamp(dbInterfaceProcess._CreateOn, new SysId(dbInterfaceProcess._CreateBy), dbInterfaceProcess._CreateHost);
interfaceProcess.SetUpdateStamp(dbInterfaceProcess._UpdateOn, new SysId(dbInterfaceProcess._UpdateBy), dbInterfaceProcess._UpdateHost);
@@ -1,15 +1,16 @@
using System;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Interfaces;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Dbas.Data;
using Sarand.Net.Standard.Dbas.Interfaces.Internal;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Interfaces;
using Sarand.Net.Standard.Dbas.Data;
using Sarand.Net.Standard.Dbas.Interfaces.Internal;
using Sarand.Net.Standard.Base.Utils;
using System.Text.RegularExpressions;
namespace Sarand.Net.Standard.Dbas.Interfaces
{
@@ -54,7 +55,7 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
private SaInterface CreateInterface(SaInterface_Db dbInterface)
{
ClearErrorState();
SaInterface saInterface = new SaInterface_Dbas(new SysId(dbInterface._Id), dbInterface._Context, (SaInterfaceCategory)dbInterface._Category, dbInterface._Type, (ushort)dbInterface._Flags);
SaInterface saInterface = new SaInterface_Dbas(new SysId(dbInterface._Id), dbInterface._Context, (SaInterfaceCategory)dbInterface._Category, dbInterface._Type ?? 0, (ushort)dbInterface._Flags);
PopulateFrom(dbInterface, saInterface);
return saInterface;
}
@@ -372,8 +373,28 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
if (!excludedIds.IsEmpty())
filter.Add(colId + " NOT IN (" + excludedIds + ")");
// Context.
String colContext = SaInterfaceDbDfn.GetColumnNameQual(SaInterfaceDbDfn.ColumnIdx.SaInterface_Context, aliasInterface);
String colCode = SaInterfaceDbDfn.GetColumnNameQual(SaInterfaceDbDfn.ColumnIdx.SaInterface_Code, aliasInterface);
String colCaption = SaInterfaceDbDfn.GetColumnNameQual(SaInterfaceDbDfn.ColumnIdx.SaInterface_Caption, aliasInterface);
String colNotes = SaInterfaceDbDfn.GetColumnNameQual(SaInterfaceDbDfn.ColumnIdx.SaInterface_Notes, aliasInterface);
// Generic search.
if (!StringUtil.IsBlank(prm.Search))
{
foreach (String search in Regex.Split(prm.Search, "[\\s,;\\-+]+"))
{
if (StringUtil.IsBlank(search)) continue;
String searchForLike = DbQuery.FormatForLike(search, true);
List<String> searchFilter = new List<string>();
searchFilter.Add($"{colContext} LIKE '%{searchForLike}%'");
searchFilter.Add($"{colCode} LIKE '%{searchForLike}%'");
searchFilter.Add($"{colCaption} LIKE '%{searchForLike}%'");
searchFilter.Add($"{colNotes} LIKE '%{searchForLike}%'");
filter.Add(searchFilter.Concat(" OR ", "(", ")"));
}
}
// Context.
if (!StringUtil.IsEmpty(prm.Context))
filter.Add(colContext + "='" + DbQuery.FormatForCondition(prm.Context) + "'");
@@ -388,12 +409,10 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
filter.Add(colType + " In (" + String.Join(",", prm.InterfaceTypesIncluded) + ")");
// Code.
String colCode = SaInterfaceDbDfn.GetColumnNameQual(SaInterfaceDbDfn.ColumnIdx.SaInterface_Code, aliasInterface);
if (!StringUtil.IsEmpty(prm.Code))
filter.Add(colCode + "='" + DbQuery.FormatForCondition(prm.Code) + "'");
// Caption.
String colCaption = SaInterfaceDbDfn.GetColumnNameQual(SaInterfaceDbDfn.ColumnIdx.SaInterface_Caption, aliasInterface);
if (!StringUtil.IsEmpty(prm.CaptionPartial))
filter.Add(colCaption + " Like '%" + DbQuery.FormatForLike(prm.CaptionPartial) + "%'");
@@ -1,4 +1,6 @@
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Interfaces;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Dbas.Base;
@@ -6,10 +8,7 @@ using Sarand.Net.Standard.Dbas.Interfaces.Internal;
using System;
using System.Collections.Generic;
using System.Data.Common;
using Microsoft.Data.SqlClient;
using System.Linq;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.App;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 3-Oct-2019 15:10:58
@@ -109,13 +108,13 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
SacsDatabase.AddValuePair(columnValues, "ProcSeq", _ProcSeq);
if (colExists_ProcDate && colExists_ProcTime)
{
SacsDatabase.AddValuePair(columnValues, colNameProcDate, DateUtil.DateToInt32(_ProcessAt));
SacsDatabase.AddValuePair(columnValues, colNameProcTime, DateUtil.TimeToInt32(_ProcessAt));
SacsDatabase.AddValuePair(columnValues, colNameProcDate, DateUtil.DateToInt32(_ProcessAt ?? DateTime.MinValue));
SacsDatabase.AddValuePair(columnValues, colNameProcTime, DateUtil.TimeToInt32(_ProcessAt ?? DateTime.MinValue));
}
if (colExists_BatchDate && colExists_BatchTime)
{
SacsDatabase.AddValuePair(columnValues, colNameBatchDate, DateUtil.DateToInt32(_BatchAt));
SacsDatabase.AddValuePair(columnValues, colNameBatchTime, DateUtil.TimeToInt32(_BatchAt));
SacsDatabase.AddValuePair(columnValues, colNameBatchDate, DateUtil.DateToInt32(_BatchAt ?? DateTime.MinValue));
SacsDatabase.AddValuePair(columnValues, colNameBatchTime, DateUtil.TimeToInt32(_BatchAt ?? DateTime.MinValue));
}
SacsDatabase.AddValuePair(columnValues, "ElapseSecs", _ElapseSecs);
SacsDatabase.AddValuePair(columnValues, "ItemCount", _ItemCount);
@@ -156,13 +155,13 @@ namespace Sarand.Net.Standard.Dbas.Interfaces
SacsDatabase.AddValuePair(columnValues, "ProcSeq", _ProcSeq);
if (colExists_ProcDate && colExists_ProcTime)
{
SacsDatabase.AddValuePair(columnValues, colNameProcDate, DateUtil.DateToInt32(_ProcessAt));
SacsDatabase.AddValuePair(columnValues, colNameProcTime, DateUtil.TimeToInt32(_ProcessAt));
SacsDatabase.AddValuePair(columnValues, colNameProcDate, DateUtil.DateToInt32(_ProcessAt ?? DateTime.MinValue));
SacsDatabase.AddValuePair(columnValues, colNameProcTime, DateUtil.TimeToInt32(_ProcessAt ?? DateTime.MinValue));
}
if (colExists_BatchDate && colExists_BatchTime)
{
SacsDatabase.AddValuePair(columnValues, colNameBatchDate, DateUtil.DateToInt32(_BatchAt));
SacsDatabase.AddValuePair(columnValues, colNameBatchTime, DateUtil.TimeToInt32(_BatchAt));
SacsDatabase.AddValuePair(columnValues, colNameBatchDate, DateUtil.DateToInt32(_BatchAt ?? DateTime.MinValue));
SacsDatabase.AddValuePair(columnValues, colNameBatchTime, DateUtil.TimeToInt32(_BatchAt ?? DateTime.MinValue));
}
SacsDatabase.AddValuePair(columnValues, "ElapseSecs", _ElapseSecs);
SacsDatabase.AddValuePair(columnValues, "ItemCount", _ItemCount);
@@ -10,7 +10,7 @@ using System.Data.Common;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:21
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:12
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Dbas.ItemOptions.Internal
{
@@ -10,7 +10,7 @@ using System.Data.Common;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:20
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:12
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Dbas.Security.Internal
{
@@ -10,7 +10,7 @@ using System.Data.Common;
using System.Linq;
//---------------------------------------------------------------------------
// Code generated by Sarand Database Utilities Thu 6-Feb-2025 13:02:20
// Code generated by Sarand Database Utilities Thu 30-Oct-2025 11:28:12
//---------------------------------------------------------------------------
namespace Sarand.Net.Standard.Dbas.Security.Internal
{
@@ -1,15 +1,14 @@
using Sarand.Net.Standard.Base.App;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Bus;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using Sarand.Net.Standard.Base.Security;
using Sarand.Net.Standard.Base.Utils;
using Sarand.Net.Standard.Dbas.Data;
using Sarand.Net.Standard.Dbas.Security.Internal;
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Text;
using Sarand.Net.Standard.Base.Utils;
namespace Sarand.Net.Standard.Dbas.Security
{
@@ -203,8 +202,8 @@ namespace Sarand.Net.Standard.Dbas.Security
securityLink.ApplicableFrom = DateUtil.Int32ToDate(dbSecurityLink._DateApplicFrom ?? 0);
securityLink.ApplicableTo = DateUtil.Int32ToDate(dbSecurityLink._DateApplicTo ?? 0);
securityLink.Status = SacsSystem.GetStatusForCode(dbSecurityLink._Status);
securityLink.SetCreateStamp(dbSecurityLink._CreateOn ?? DateTime.MinValue, new SysId(dbSecurityLink._CreateBy ?? 0), dbSecurityLink._CreateHost);
securityLink.SetUpdateStamp(dbSecurityLink._UpdateOn ?? DateTime.MinValue, new SysId(dbSecurityLink._UpdateBy ?? 0), dbSecurityLink._UpdateHost);
securityLink.SetCreateStamp(dbSecurityLink._CreateOn, new SysId(dbSecurityLink._CreateBy), dbSecurityLink._CreateHost);
securityLink.SetUpdateStamp(dbSecurityLink._UpdateOn, new SysId(dbSecurityLink._UpdateBy), dbSecurityLink._UpdateHost);
securityLink.AcceptChanges();
}
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<DbDfnDatabase xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<?xml version="1.0" encoding="utf-8"?>
<DbDfnDatabase xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Tables>
<DbDfnTable>
<Schema>dbo</Schema>
@@ -101,8 +101,8 @@
<DataTypeNative>-9</DataTypeNative>
<DataTypeNameNative>nvarchar</DataTypeNameNative>
<IsIdentity>false</IsIdentity>
<Size>50</Size>
<BufferLen>100</BufferLen>
<Size>100</Size>
<BufferLen>200</BufferLen>
<DecimalDigits>0</DecimalDigits>
<Nullable>NoNulls</Nullable>
<IsNullable>false</IsNullable>
@@ -266,14 +266,14 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterface</Table>
<Name>PK_SaInterface</Name>
<Name>PK_Interface</Name>
<IndexType>1</IndexType>
<Unique>true</Unique>
<Primary>false</Primary>
<Clustered>false</Clustered>
<Nullable>false</Nullable>
<Pages>1</Pages>
<UniqueValues>1</UniqueValues>
<Pages>0</Pages>
<UniqueValues>0</UniqueValues>
<HasColumns>false</HasColumns>
<Columns>
<DbDfnIndexColumn>
@@ -286,7 +286,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterface</Table>
<Name>IDX_SaInterface_ContextCode</Name>
<Name>IDX_Interface_ContextCode</Name>
<IndexType>3</IndexType>
<Unique>true</Unique>
<Primary>false</Primary>
@@ -311,7 +311,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterface</Table>
<Name>IDX_SaInterface_ContextCategoryType</Name>
<Name>IDX_Interface_ContextCategoryType</Name>
<IndexType>3</IndexType>
<Unique>false</Unique>
<Primary>false</Primary>
@@ -690,7 +690,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceDataItem</Table>
<Name>PK_SaInterfaceDataItem</Name>
<Name>PK_InterfaceDataItem</Name>
<IndexType>1</IndexType>
<Unique>true</Unique>
<Primary>false</Primary>
@@ -710,7 +710,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceDataItem</Table>
<Name>IDX_SaInterfaceDataItem_InterfaceItemRef</Name>
<Name>IDX_InterfaceDataItem_InterfaceItemRef</Name>
<IndexType>3</IndexType>
<Unique>true</Unique>
<Primary>false</Primary>
@@ -750,7 +750,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceDataItem</Table>
<Name>IDX_SaInterfaceDataItem_InterfaceStatusItemRef</Name>
<Name>IDX_InterfaceDataItem_InterfaceStatusItemRef</Name>
<IndexType>3</IndexType>
<Unique>true</Unique>
<Primary>false</Primary>
@@ -795,7 +795,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceDataItem</Table>
<Name>IDX_SaInterfaceDataItem_InterfaceDirectionItemRef</Name>
<Name>IDX_InterfaceDataItem_InterfaceDirectionItemRef</Name>
<IndexType>3</IndexType>
<Unique>false</Unique>
<Primary>false</Primary>
@@ -830,7 +830,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceDataItem</Table>
<Name>IDX_SaInterfaceDataItem_Item</Name>
<Name>IDX_InterfaceDataItem_Item</Name>
<IndexType>3</IndexType>
<Unique>false</Unique>
<Primary>false</Primary>
@@ -855,7 +855,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceDataItem</Table>
<Name>IDX_SaInterfaceDataItem_ItemExternal</Name>
<Name>IDX_InterfaceDataItem_ItemExternal</Name>
<IndexType>3</IndexType>
<Unique>false</Unique>
<Primary>false</Primary>
@@ -1178,14 +1178,14 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceProcess</Table>
<Name>PK_SaInterfaceProcess</Name>
<Name>PK_InterfaceProcess</Name>
<IndexType>1</IndexType>
<Unique>true</Unique>
<Primary>false</Primary>
<Clustered>false</Clustered>
<Nullable>false</Nullable>
<Pages>1</Pages>
<UniqueValues>22</UniqueValues>
<Pages>0</Pages>
<UniqueValues>0</UniqueValues>
<HasColumns>false</HasColumns>
<Columns>
<DbDfnIndexColumn>
@@ -1198,7 +1198,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceProcess</Table>
<Name>IDX_SaInterfaceProcess_IntDirSeq</Name>
<Name>IDX_InterfaceProcess_IntDirSeq</Name>
<IndexType>3</IndexType>
<Unique>true</Unique>
<Primary>false</Primary>
@@ -1228,32 +1228,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceProcess</Table>
<Name>IDX_SaInterfaceProcess_IntProcAt</Name>
<IndexType>3</IndexType>
<Unique>false</Unique>
<Primary>false</Primary>
<Clustered>false</Clustered>
<Nullable>false</Nullable>
<Pages>0</Pages>
<UniqueValues>0</UniqueValues>
<HasColumns>false</HasColumns>
<Columns>
<DbDfnIndexColumn>
<Seq>1</Seq>
<Name>InterfaceId</Name>
<Ascend>true</Ascend>
</DbDfnIndexColumn>
<DbDfnIndexColumn>
<Seq>2</Seq>
<Name>ProcessAt</Name>
<Ascend>true</Ascend>
</DbDfnIndexColumn>
</Columns>
</DbDfnIndex>
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceProcess</Table>
<Name>IDX_SaInterfaceProcess_IntProcRef</Name>
<Name>IDX_InterfaceProcess_IntProc</Name>
<IndexType>3</IndexType>
<Unique>false</Unique>
<Primary>false</Primary>
@@ -1474,7 +1449,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceProcessDataItem</Table>
<Name>PK_SaInterfaceProcessDataItem</Name>
<Name>PK_InterfaceProcessDataItem</Name>
<IndexType>1</IndexType>
<Unique>true</Unique>
<Primary>false</Primary>
@@ -1499,7 +1474,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceProcessDataItem</Table>
<Name>IDX_SaInterfaceProcessDataItem_Item</Name>
<Name>IDX_InterfaceProcessDataItem_Item</Name>
<IndexType>3</IndexType>
<Unique>false</Unique>
<Primary>false</Primary>
@@ -1519,7 +1494,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceProcessDataItem</Table>
<Name>IDX_SaInterfaceProcessDataItem_ProcessItemData</Name>
<Name>IDX_InterfaceProcessDataItem_ProcItemData</Name>
<IndexType>3</IndexType>
<Unique>false</Unique>
<Primary>false</Primary>
@@ -1589,11 +1564,11 @@
<Name>MsgType</Name>
<DataType>VarChar</DataType>
<DataTypeName />
<DataTypeNative>12</DataTypeNative>
<DataTypeNameNative>varchar</DataTypeNameNative>
<DataTypeNative>-9</DataTypeNative>
<DataTypeNameNative>nvarchar</DataTypeNameNative>
<IsIdentity>false</IsIdentity>
<Size>3</Size>
<BufferLen>3</BufferLen>
<BufferLen>6</BufferLen>
<DecimalDigits>0</DecimalDigits>
<Nullable>Nullable</Nullable>
<IsNullable>true</IsNullable>
@@ -1609,8 +1584,8 @@
<DataTypeNative>-9</DataTypeNative>
<DataTypeNameNative>nvarchar</DataTypeNameNative>
<IsIdentity>false</IsIdentity>
<Size>1024</Size>
<BufferLen>2048</BufferLen>
<Size>4000</Size>
<BufferLen>8000</BufferLen>
<DecimalDigits>0</DecimalDigits>
<Nullable>Nullable</Nullable>
<IsNullable>true</IsNullable>
@@ -1759,11 +1734,11 @@
<Name>CreateHost</Name>
<DataType>VarChar</DataType>
<DataTypeName />
<DataTypeNative>-9</DataTypeNative>
<DataTypeNameNative>nvarchar</DataTypeNameNative>
<DataTypeNative>12</DataTypeNative>
<DataTypeNameNative>varchar</DataTypeNameNative>
<IsIdentity>false</IsIdentity>
<Size>64</Size>
<BufferLen>128</BufferLen>
<BufferLen>64</BufferLen>
<DecimalDigits>0</DecimalDigits>
<Nullable>Nullable</Nullable>
<IsNullable>true</IsNullable>
@@ -1810,11 +1785,11 @@
<Name>UpdateHost</Name>
<DataType>VarChar</DataType>
<DataTypeName />
<DataTypeNative>-9</DataTypeNative>
<DataTypeNameNative>nvarchar</DataTypeNameNative>
<DataTypeNative>12</DataTypeNative>
<DataTypeNameNative>varchar</DataTypeNameNative>
<IsIdentity>false</IsIdentity>
<Size>64</Size>
<BufferLen>128</BufferLen>
<BufferLen>64</BufferLen>
<DecimalDigits>0</DecimalDigits>
<Nullable>Nullable</Nullable>
<IsNullable>true</IsNullable>
@@ -1825,14 +1800,14 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceProcessMessage</Table>
<Name>PK_SaInterfaceProcessMessage</Name>
<Name>PK_InterfaceProcessMessage</Name>
<IndexType>1</IndexType>
<Unique>true</Unique>
<Primary>false</Primary>
<Clustered>false</Clustered>
<Nullable>false</Nullable>
<Pages>12</Pages>
<UniqueValues>342</UniqueValues>
<Pages>0</Pages>
<UniqueValues>0</UniqueValues>
<HasColumns>false</HasColumns>
<Columns>
<DbDfnIndexColumn>
@@ -1845,7 +1820,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceProcessMessage</Table>
<Name>IDX_SaInterfaceProcessMessage_Process</Name>
<Name>IDX_InterfaceProcessMessage_Process</Name>
<IndexType>3</IndexType>
<Unique>false</Unique>
<Primary>false</Primary>
@@ -1865,7 +1840,7 @@
<DbDfnIndex>
<Schema>dbo</Schema>
<Table>SaInterfaceProcessMessage</Table>
<Name>IDX_SaInterfaceProcessMessage_ProcessMsgType</Name>
<Name>IDX_InterfaceProcessMessage_ProcMsgType</Name>
<IndexType>3</IndexType>
<Unique>false</Unique>
<Primary>false</Primary>