Files
andy 9f22b522df v1.3.0 Restructure Saxonite workspace and upgrade to .NET 10 (#1)
Move Saxonite’s projects into a dedicated `Workspace` folder and align the solution with .NET 10 and the current Common workspace. Update encryption integration, test project structure and coverage, and repository guidance and upgrade notes.

- Relocate application and library projects while retaining Git rename history.
- Split tests into Admin, Online, and Shared projects; add representative behavioral and serialization tests.
- Update Common integration, application version, and repository documentation.

Application version: 1.3.0

Reviewed-on: #1
Co-authored-by: andy <andy@sarand.com>
2026-10-16 18:24:16 +01:00

75 lines
2.6 KiB
C#

using Sarand.Net.Standard.Dbas.Data;
using Sarand.Net.Standard.Base.Core;
using Sarand.Net.Standard.Base.Dbas;
using System;
using System.Collections.Generic;
using System.Text;
using Sarand.Net.Standard.Base.Utils;
namespace Saxonite.Net.Standard.Dbas.Data
{
//=======================================================================
public abstract class SaxDbDataItem : DbDataItem
{
//-------------------------------------------------------------------
// Definitions.
/// <summary>
/// Database information - object supplied by main application.
/// <para>NB Application may have multiple databases with schema differences.</para>
/// <para>Each instance of a DbDataItem must be database specific.</para>
/// </summary>
public class SlmDatabaseInfo : IDatabaseInfo
{
// Data members.
private readonly List<DbDfnTable> tables;
private static readonly String defaultSchemaName = "dbo";
// Construction.
public SlmDatabaseInfo(String databaseName, List<DbDfnTable> tables)
{
this.DatabaseName = databaseName;
this.tables = tables;
}
// Properties.
public String DatabaseName { get; }
public String Context { get { return StringUtil.OnEmpty(DatabaseName, "UnknownDb"); } }
// Database schema.
public DbDfnTable GetTableDefinition(String schemaName, String tableName)
{
foreach (DbDfnTable table in tables.FindAll(item => item.Name.EqualsCI(tableName)))
{
if (StringUtil.OnEmpty(table.Schema, defaultSchemaName).EqualsCI(StringUtil.OnEmpty(schemaName, defaultSchemaName)))
return table;
}
return null;
}
public bool TableExists(String schemaName, String tableName)
{
return GetTableDefinition(schemaName, tableName) != null;
}
public bool ColumnExists(String schemaName, String tableName, String columnName)
{
DbDfnTable table = GetTableDefinition(schemaName, tableName);
if (table == null) return false;
return table.HasColumnByName(columnName);
}
public List<DbDfnColumn> GetColumnsForTable(String schemaName, String tableName)
{
DbDfnTable table = GetTableDefinition(schemaName, tableName);
if (table != null) return table.Columns;
return new List<DbDfnColumn>();
}
}
//-------------------------------------------------------------------
// Construction.
protected SaxDbDataItem(IDatabaseInfo dbInfo) : base(dbInfo)
{
}
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}
//=======================================================================
}