/*
* Namespace Summary
* Copyright (C) 2005+ Bogdan Damian Constantin
* E-Mail: damianbcpetro@gmail.com
* WEB: http://www.sourceforge.net/projects/dataholder
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License 2.1 or later, as
* published by the Free Software Foundation. See the included License.txt
* or http://www.gnu.org/copyleft/lesser.html for details.
*
*/
using System;
namespace DataHolder.DataPersistence.DBAProvider.Properties{
/// <summary>
/// This defind the link between the GenericData property and the DataTable Field
/// In order to save the Generic this Persistence field should be used
/// </summary>
public class TablePersistenceField:APersistenceField
{
protected int l_TableIndex;
protected string l_FieldName;
protected string l_Alias;
protected bool l_SaveConcurrencyCheck = true;
public TablePersistenceField(string p_PropertyName, int p_TableIndex, string p_FieldName, string p_Alias):base(p_PropertyName)
{
l_TableIndex = p_TableIndex;
l_FieldName = p_FieldName;
if(p_Alias != null)
{
l_Alias = p_Alias.Trim();
if(l_Alias.Length == 0)
l_Alias = null;
}
if(p_TableIndex < 0)
throw new ApplicationException("Invalid table index for " + p_PropertyName +"; The index should be equal or grater 0");
}
public TablePersistenceField(string p_PropertyName, int p_TableIndex, string p_FieldName, string p_Alias, bool SaveConcurrencyCheck)
:this(p_PropertyName, p_TableIndex, p_FieldName, p_Alias)
{
l_SaveConcurrencyCheck = SaveConcurrencyCheck;
}
public int TableIndex
{
get{return l_TableIndex;}
}
public string FiledName
{
get{return l_FieldName;}
}
public override string RecordSetName
{
get
{
if(l_Alias != null)
return l_Alias;
else
return l_FieldName;
}
}
public override string Alias
{
get{return l_Alias;}
}
public override bool SaveConcurrencyCheck
{
get
{
return l_SaveConcurrencyCheck;
}
}
}
}
|