kreta/Framework/Entities/EntityPropertyAttribute.cs
2024-03-13 00:33:46 +01:00

154 lines
5 KiB
C#

using System;
namespace Kreta.Framework.Entities
{
/// <summary>
/// Entitás tulajdonságait leíró attribútum.
/// </summary>
[AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = true)]
public sealed class EntityPropertyAttribute : Attribute
{
private string m_Name;
private EntityPropertyBaseType m_BaseType;
private Type m_PropertyType;
private EntityCopyMethod m_CopyMethod;
private string m_AssocFieldName;
private string m_TableName;
private string m_PartnerAssocFieldName;
/// <summary>
/// Az osztály konstruktora
/// </summary>
/// <param name="name">A tulajdonság neve</param>
/// <param name="baseType">A tulajdonság alaptípusa</param>
/// <param name="propertyType">A tulajdonság .NET típusa</param>
/// <param name="copyMethod">A tulajdonság másolási módja</param>
public EntityPropertyAttribute(string name, EntityPropertyBaseType baseType, Type propertyType, EntityCopyMethod copyMethod)
{
m_Name = name;
m_BaseType = baseType;
m_PropertyType = propertyType;
m_CopyMethod = copyMethod;
}
/// <summary>
/// Az osztály konstruktora
/// </summary>
/// <param name="name">A tulajdonság neve</param>
/// <param name="baseType">A tulajdonság alaptípusa</param>
/// <param name="propertyType">A tulajdonság .NET típusa</param>
/// <param name="copyMethod">A tulajdonság másolási módja</param>
/// <param name="assocfieldname">A tulajdonság asszociációs osztályának kapcsoló ID mezője.</param>
public EntityPropertyAttribute(string name, EntityPropertyBaseType baseType, Type propertyType, EntityCopyMethod copyMethod, string assocfieldname)
{
m_Name = name;
m_BaseType = baseType;
m_PropertyType = propertyType;
m_CopyMethod = copyMethod;
m_AssocFieldName = assocfieldname;
}
/// <summary>
/// Az osztály konstruktora
/// </summary>
/// <param name="name">A tulajdonság neve</param>
/// <param name="baseType">A tulajdonság alaptípusa</param>
/// <param name="propertyType">A tulajdonság .NET típusa</param>
/// <param name="copyMethod">A tulajdonság másolási módja</param>
/// <param name="assocfieldname">A tulajdonság asszociációs osztályának kapcsoló ID mezője.</param>
public EntityPropertyAttribute(string name, EntityPropertyBaseType baseType, Type propertyType, EntityCopyMethod copyMethod, string assocfieldname, string partnerassocfieldname, string tablename)
{
m_Name = name;
m_BaseType = baseType;
m_PropertyType = propertyType;
m_CopyMethod = copyMethod;
m_AssocFieldName = assocfieldname;
m_PartnerAssocFieldName = partnerassocfieldname;
m_TableName = tablename;
}
/// <summary>
/// A tulajdonság neve.
/// </summary>
public string Name
{
get
{
return m_Name;
}
}
public string AssocFieldName
{
get
{
return m_AssocFieldName;
}
}
public string PartnerAssocFieldName
{
get
{
return m_PartnerAssocFieldName;
}
}
public string TableName
{
get
{
return m_TableName;
}
}
/// <summary>
/// A tulajdonság fajtája.
/// </summary>
public EntityPropertyBaseType BaseType
{
get
{
return m_BaseType;
}
}
/// <summary>
/// A tulajdonság típusa.
/// </summary>
public Type PropertyType
{
get
{
return m_PropertyType;
}
}
/// <summary>
/// A tulajdonság másolási módja.
/// </summary>
/// <remarks>
/// Entitás másolásánál használatos, és megmondja, hogy a másolat entitásnál
/// a tulajdonságot milyen módon kell másolni. Asszociációknál van értelmezve.
/// <list type="bullet">
/// <item>
/// <term>DeepCopy</term>
/// <description>Az asszociációs partnert is le kell másolni.</description>
/// </item>
/// <item>
/// <term>ShallowCopy</term>
/// <description>Az asszociációs partnert nem kell másolni, a másolat identitása megegyezhet
/// az eredetivel.
/// </description>
/// </item>
/// </list>
/// </remarks>
public EntityCopyMethod CopyMethod
{
get
{
return m_CopyMethod;
}
}
}
}