- nantgenie-12305.zip
- Agile
- Agile.Common
- Components
- nunit.framework.dll
- Silverlight
- Blacklight.Silverlight.Controls.dll
- Unity
- Wintellect
- Wintellect.Threading.CompactFx.dll
- Wintellect.Threading.CompactFx.pdb
- Wintellect.Threading.CompactFx.XML
- Wintellect.Threading.dll
- Wintellect.Threading.pdb
- Wintellect.Threading.Silverlight.dll
- Wintellect.Threading.Silverlight.pdb
- Wintellect.Threading.Silverlight.XML
- Wintellect.Threading.XML
- Descriptors
- Descriptors
- GeneratorDetails
- Generators
- Generator.Tests
- Generators
- NantGenie.sln
- NantGenie
|
using System.Data;
using GeneratorCustomization;
namespace Descriptors.GeneratorCustomization
{
/// <summary>
/// Container for all tables that are lookup tables.
/// For these tables, some things should be generated differently,
/// e.g. a GetAll method should cache the result set.
/// </summary>
public class LookupTable
{
private readonly string _database;
private readonly string _diplayColumn;
private readonly string _table;
/// <summary>
/// Gets the name of the table that contains lookup table customization data.
/// </summary>
public const string TableName = "LookupTable";
/// <summary>
/// Create with customization data
/// </summary>
private LookupTable(DataRow row)
: this(row["Database"].ToString(), row["TableName"].ToString(), row["DisplayColumn"].ToString())
{
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="database">Name of the database the table is in.</param>
/// <param name="table">Name of the table the column is in.</param>
/// <param name="displayColumn">Name of the display column.</param>
private LookupTable(string database, string table, string displayColumn)
{
_database = database;
_table = table;
_diplayColumn = displayColumn;
}
/// <summary>
/// Name of the display column (i.e. the one to display to the user.).
/// </summary>
public string DisplayColumn
{
get { return _diplayColumn; }
}
/// <summary>
/// Name of the table the special column is in.
/// </summary>
/// <remarks>If this is an empty string then the special rule should apply to ALL tables.</remarks>
public string Table
{
get { return _table; }
}
/// <summary>
/// Name of the database the table is in.
/// </summary>
/// <remarks>If this is an empty string then the special rule should apply to ALL tables in ALL databases.</remarks>
public string Database
{
get { return _database; }
}
/// <summary>
/// Instantiate a new excluded table column with all required fields.
/// </summary>
/// <param name="database">Name of the database the table is in.</param>
/// <param name="table">Name of the table the column is in.</param>
/// <param name="displayColumn">Name of the display column.</param>
/// <returns></returns>
public static LookupTable Build(string database, string table, string displayColumn)
{
return new LookupTable(database, table, displayColumn);
}
/// <summary>
/// Instantiate a new excluded table column with all required fields.
/// </summary>
/// <param name="database">Name of the database the table is in.</param>
/// <param name="table">Name of the table the column is in.</param>
public static LookupTable Build(string database, string table)
{
DataRow row = GeneratorsData.TableMatchGetRow(TableName, database, table, true);
if (row == null)
return null;
LookupTable lookupTable = new LookupTable(row);
return lookupTable;
}
#region Nested type: Testing
/// <summary>
/// Support methods for testing use only
/// </summary>
public class Testing
{
/// <summary>
/// Get the test excluded column. Details are:-
/// TestDatabase; TestTable; TestColumn
/// </summary>
/// <returns></returns>
public static LookupTable GetTestColumn()
{
return Build("TestDatabase", "TestTable", "TestColumn");
}
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I live in Sydney and have been a developer for almost a decade now. I have a passion for technology and a strong interest in discovering 'better, cleaner, faster' ways to get systems out the door because I believe software development takes too long. If I have an idea I want to realise it as quickly as possible...plus writing systems for someone else I want to deliver quickly so I can move onto the next interesting project!