kreta/Kreta.DataAccessGenerated/Entities/ErettsegiKerdes.cs
2024-03-13 00:33:46 +01:00

1013 lines
32 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using Kreta.DataAccess.Interfaces;
using Kreta.Framework;
using Kreta.Framework.Actions;
using Kreta.Framework.Collections;
using Kreta.Framework.Collections.Generic;
using Kreta.Framework.Entities;
using Kreta.Framework.Entities.Generic;
using Kreta.Framework.Exceptions;
namespace SDA.Kreta.Entities
{
/// <summary>
/// Az UML modell ErettsegiKerdes entitásának megvalósítása.
/// </summary>
/// <remarks>A kód teljes egészében generált, kézi módosítása nem megengedett!</remarks>
[Entity("ErettsegiKerdes")]
// alapértelmezett EntityHistoryMode
public class ErettsegiKerdes : Entity, IErettsegiKerdes
{
internal protected ErettsegiKerdes()
: base()
{
}
public class AttributeInfo
{
public const string Cim = "Cim";
public const string ErettsegiSzintId = "ErettsegiSzintId";
public const string ErettsegiTantargyId = "ErettsegiTantargyId";
public const string HelyesValasz = "HelyesValasz";
public const string Kategoria = "Kategoria";
public const string Kep = "Kep";
public const string Kerdes = "Kerdes";
public const string Szoveg = "Szoveg";
public const string Tema = "Tema";
public const string ValaszB = "ValaszB";
public const string ValaszC = "ValaszC";
public const string ValaszD = "ValaszD";
public const string ValaszE = "ValaszE";
public const string ValaszF = "ValaszF";
public const string ValaszSzoveges = "ValaszSzoveges";
}
public class AttributeLengthInfo
{
public const int CimLength = 4000;
public const int HelyesValaszLength = 4000;
public const int KategoriaLength = 10;
public const int KepLength = 2147483647;
public const int KerdesLength = 4000;
public const int SzovegLength = 4000;
public const int TemaLength = 4000;
public const int ValaszBLength = 4000;
public const int ValaszCLength = 4000;
public const int ValaszDLength = 4000;
public const int ValaszELength = 4000;
public const int ValaszFLength = 4000;
public const int ValaszSzovegesLength = 4000;
}
#region General
private ErettsegiKerdesDA m_DA = new ErettsegiKerdesDA();
protected static ErettsegiKerdes FakeErettsegiKerdes { get; set; }
public static ErettsegiKerdes GiveAnInstance()
{
ErettsegiKerdes result = FakeErettsegiKerdes == null
? new ErettsegiKerdes()
: (ErettsegiKerdes)FakeErettsegiKerdes.MemberwiseClone();
result.Reset();
result.SetDefaultData();
return result;
}
protected void SetDefaultData()
{
if (UserContext.Instance != null)
{
if (UserContext.Instance.IntezmenyId > 0)
{
IntezmenyId = UserContext.Instance.IntezmenyId;
}
if (UserContext.Instance.AktivTanevId > 0)
{
TanevId = UserContext.Instance.AktivTanevId;
}
m_State = EntityState.Uninitialized;
}
}
protected override IEntityDataAccessor GetDataAccessor() { return m_DA; }
protected internal virtual IEntityDataAccessor InheritedDA { get { return null; } }
[Obsolete("Ezt ne használjátok, mert mindenhova bele kellene fogalmazni a tanév szűrést is! Meg fog majd szűnni!")]
public static IEntityCollection<ErettsegiKerdes> LoadAll()
{
return LoadWithFilter("");
}
[Obsolete("Ezt ne használjátok, mert mindenhova bele kellene fogalmazni a tanév szűrést is! Meg fog majd szűnni!")]
public static IEntityCollection<ErettsegiKerdes> LoadAll(ColumnFilterMode columnFilterMode, IEnumerable<string> columns)
{
return LoadWithFilter("", columnFilterMode, columns);
}
[Obsolete("Ezt ne használjátok, mert mindenhova bele kellene fogalmazni a tanév szűrést is! Meg fog majd szűnni!")]
public static IEntityCollection<ErettsegiKerdes> LoadWithFilter(string filter, Dictionary<string, object> commandParameters = null)
{
var result = new EntityCollection<ErettsegiKerdes>();
new ErettsegiKerdesDA().LoadWithFilter(result, filter, commandParameters);
return result;
}
[Obsolete("Ezt ne használjátok, mert mindenhova bele kellene fogalmazni a tanév szűrést is! Meg fog majd szűnni!")]
public static IEntityCollection<ErettsegiKerdes> LoadWithFilter(string filter, ColumnFilterMode columnFilterMode, IEnumerable<string> columns, Dictionary<string, object> commandParameters = null)
{
var result = new EntityCollection<ErettsegiKerdes>();
new ErettsegiKerdesDA().LoadWithFilter(result, filter, columnFilterMode, columns, commandParameters);
return result;
}
protected override void StoreOriginalValues()
{
base.StoreOriginalValues();
OriginalValues.Add("Cim", (Cim == null ? (object)DBNull.Value : (object)m_Cim));
OriginalValues.Add("ErettsegiSzintId", (ErettsegiSzintId == null ? (object)DBNull.Value : (object)m_ErettsegiSzintId));
OriginalValues.Add("ErettsegiTantargyId", (ErettsegiTantargyId == null ? (object)DBNull.Value : (object)m_ErettsegiTantargyId));
OriginalValues.Add("HelyesValasz", (HelyesValasz == null ? (object)DBNull.Value : (object)m_HelyesValasz));
OriginalValues.Add("Kategoria", (object)m_Kategoria);
OriginalValues.Add("Kep", (Kep == null ? (object)DBNull.Value : (object)m_Kep));
OriginalValues.Add("Kerdes", (object)m_Kerdes);
OriginalValues.Add("Szoveg", (Szoveg == null ? (object)DBNull.Value : (object)m_Szoveg));
OriginalValues.Add("Tema", (object)m_Tema);
OriginalValues.Add("ValaszB", (ValaszB == null ? (object)DBNull.Value : (object)m_ValaszB));
OriginalValues.Add("ValaszC", (ValaszC == null ? (object)DBNull.Value : (object)m_ValaszC));
OriginalValues.Add("ValaszD", (ValaszD == null ? (object)DBNull.Value : (object)m_ValaszD));
OriginalValues.Add("ValaszE", (ValaszE == null ? (object)DBNull.Value : (object)m_ValaszE));
OriginalValues.Add("ValaszF", (ValaszF == null ? (object)DBNull.Value : (object)m_ValaszF));
OriginalValues.Add("ValaszSzoveges", (ValaszSzoveges == null ? (object)DBNull.Value : (object)m_ValaszSzoveges));
OriginalValues.Add("IntezmenyId", (m_IntezmenyId < 0 ? (object)DBNull.Value : (object)m_IntezmenyId));
OriginalValues.Add("TanevId", (m_TanevId < 0 ? (object)DBNull.Value : (object)m_TanevId));
}
#endregion
#region Ellenőrzés
protected override void Validate(bool skipValidateAttributes = false)
{
base.Validate();
if (!skipValidateAttributes)
{
// korlátos hosszúságú mezők ellenőrzése...
if (m_Cim != null && m_Cim.Length > 4000)
{
throw new InvalidEntityAttributeException("ErettsegiKerdes", "Cim", EntityAttributeError.TooLong);
}
if (m_HelyesValasz != null && m_HelyesValasz.Length > 4000)
{
throw new InvalidEntityAttributeException("ErettsegiKerdes", "HelyesValasz", EntityAttributeError.TooLong);
}
if (m_Kategoria != null && m_Kategoria.Length > 10)
{
throw new InvalidEntityAttributeException("ErettsegiKerdes", "Kategoria", EntityAttributeError.TooLong);
}
if (m_Kep != null && m_Kep.Length > 2147483647)
{
throw new InvalidEntityAttributeException("ErettsegiKerdes", "Kep", EntityAttributeError.TooLong);
}
if (m_Kerdes != null && m_Kerdes.Length > 4000)
{
throw new InvalidEntityAttributeException("ErettsegiKerdes", "Kerdes", EntityAttributeError.TooLong);
}
if (m_Szoveg != null && m_Szoveg.Length > 4000)
{
throw new InvalidEntityAttributeException("ErettsegiKerdes", "Szoveg", EntityAttributeError.TooLong);
}
if (m_Tema != null && m_Tema.Length > 4000)
{
throw new InvalidEntityAttributeException("ErettsegiKerdes", "Tema", EntityAttributeError.TooLong);
}
if (m_ValaszB != null && m_ValaszB.Length > 4000)
{
throw new InvalidEntityAttributeException("ErettsegiKerdes", "ValaszB", EntityAttributeError.TooLong);
}
if (m_ValaszC != null && m_ValaszC.Length > 4000)
{
throw new InvalidEntityAttributeException("ErettsegiKerdes", "ValaszC", EntityAttributeError.TooLong);
}
if (m_ValaszD != null && m_ValaszD.Length > 4000)
{
throw new InvalidEntityAttributeException("ErettsegiKerdes", "ValaszD", EntityAttributeError.TooLong);
}
if (m_ValaszE != null && m_ValaszE.Length > 4000)
{
throw new InvalidEntityAttributeException("ErettsegiKerdes", "ValaszE", EntityAttributeError.TooLong);
}
if (m_ValaszF != null && m_ValaszF.Length > 4000)
{
throw new InvalidEntityAttributeException("ErettsegiKerdes", "ValaszF", EntityAttributeError.TooLong);
}
if (m_ValaszSzoveges != null && m_ValaszSzoveges.Length > 4000)
{
throw new InvalidEntityAttributeException("ErettsegiKerdes", "ValaszSzoveges", EntityAttributeError.TooLong);
}
}
// kötelező asszociációk ellenőrzése...
if (m_IntezmenyId == -1) { throw new InvalidEntityAttributeException("ErettsegiKerdes", "IntezmenyId", EntityAttributeError.Empty); }
if (m_TanevId == -1) { throw new InvalidEntityAttributeException("ErettsegiKerdes", "TanevId", EntityAttributeError.Empty); }
}
#endregion
#region Alaphelyzetbe állítás
protected override void Reset()
{
base.Reset();
// alaphelyzetbe állítjuk az egyszerű mezőket
this.m_Cim = null;
this.m_ErettsegiSzintId = null;
this.m_ErettsegiTantargyId = null;
this.m_HelyesValasz = null;
this.m_Kategoria = "";
this.m_Kep = null;
this.m_Kerdes = "";
this.m_Szoveg = null;
this.m_Tema = "";
this.m_ValaszB = null;
this.m_ValaszC = null;
this.m_ValaszD = null;
this.m_ValaszE = null;
this.m_ValaszF = null;
this.m_ValaszSzoveges = null;
// alaphelyzetbe állítjuk az asszociációkból származó mezőket
this.m_ErettsegiValasz = null; // EntityCollection
this.m_IntezmenyId = -1;
this.m_Intezmeny = null; // Entity
this.m_TanevId = -1;
this.m_Tanev = null; // Entity
}
#endregion
protected override void DeAssociateBeforeDelete(bool runHandler = false)
{
// Nem kaszkád törölhető asszociációk ellenőrzése, hogy üresek-e...
if (this.ErettsegiValasz.Count > 0)
{
throw new EntityDeleteFailedException("ErettsegiKerdes", "ErettsegiValasz", EntityUtil.GetAssociationDescription("T_ERETTSEGIVALASZ_OSSZES", "C_ERETTSEGIKERDESID")); // nincs kapcsolotabla
}
// Intezmeny esetében mi mutatunk a másikra: startrole: *, endrole: 1
// Tanev esetében mi mutatunk a másikra: startrole: *, endrole: 1
// kaszkád törlések...
}
#region Mezők és tulajdonságok
#region Egyszerű mezők
#region Cim
protected internal string m_Cim;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("Cim", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string Cim
{
get
{
return m_Cim;
}
set
{
CheckModifyable();
if (m_Cim == value) return;
m_Cim = value;
FieldModified("Cim", value);
}
}
#endregion
#region ErettsegiSzintId
protected internal int? /* DictionaryItem */ m_ErettsegiSzintId;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("ErettsegiSzintId", EntityPropertyBaseType.ValueType, typeof(int /* DictionaryItem */), EntityCopyMethod.ShallowCopy)]
[EntityDictionaryItemProperty("ErettsegiSzintId", "ErettsegiSzint", typeof(SDA.Kreta.Entities.ErettsegiSzint))]
public virtual int? /* DictionaryItem */ ErettsegiSzintId
{
get
{
return m_ErettsegiSzintId;
}
set
{
CheckModifyable();
if (m_ErettsegiSzintId == value) return;
m_ErettsegiSzintId = value;
FieldModified("ErettsegiSzintId", value);
}
}
#endregion
#region ErettsegiTantargyId
protected internal int? /* DictionaryItem */ m_ErettsegiTantargyId;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("ErettsegiTantargyId", EntityPropertyBaseType.ValueType, typeof(int /* DictionaryItem */), EntityCopyMethod.ShallowCopy)]
[EntityDictionaryItemProperty("ErettsegiTantargyId", "ErettsegiTantargy", typeof(SDA.Kreta.Entities.ErettsegiTantargy))]
public virtual int? /* DictionaryItem */ ErettsegiTantargyId
{
get
{
return m_ErettsegiTantargyId;
}
set
{
CheckModifyable();
if (m_ErettsegiTantargyId == value) return;
m_ErettsegiTantargyId = value;
FieldModified("ErettsegiTantargyId", value);
}
}
#endregion
#region HelyesValasz
protected internal string m_HelyesValasz;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("HelyesValasz", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string HelyesValasz
{
get
{
return m_HelyesValasz;
}
set
{
CheckModifyable();
if (m_HelyesValasz == value) return;
m_HelyesValasz = value;
FieldModified("HelyesValasz", value);
}
}
#endregion
#region Kategoria
protected internal string m_Kategoria;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("Kategoria", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string Kategoria
{
get
{
return m_Kategoria;
}
set
{
CheckModifyable();
if (m_Kategoria == value) return;
m_Kategoria = value;
FieldModified("Kategoria", value);
}
}
#endregion
#region Kep
protected internal string m_Kep;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("Kep", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string Kep
{
get
{
return m_Kep;
}
set
{
CheckModifyable();
if (m_Kep == value) return;
m_Kep = value;
FieldModified("Kep", value);
}
}
#endregion
#region Kerdes
protected internal string m_Kerdes;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("Kerdes", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string Kerdes
{
get
{
return m_Kerdes;
}
set
{
CheckModifyable();
if (m_Kerdes == value) return;
m_Kerdes = value;
FieldModified("Kerdes", value);
}
}
#endregion
#region Szoveg
protected internal string m_Szoveg;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("Szoveg", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string Szoveg
{
get
{
return m_Szoveg;
}
set
{
CheckModifyable();
if (m_Szoveg == value) return;
m_Szoveg = value;
FieldModified("Szoveg", value);
}
}
#endregion
#region Tema
protected internal string m_Tema;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("Tema", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string Tema
{
get
{
return m_Tema;
}
set
{
CheckModifyable();
if (m_Tema == value) return;
m_Tema = value;
FieldModified("Tema", value);
}
}
#endregion
#region ValaszB
protected internal string m_ValaszB;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("ValaszB", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string ValaszB
{
get
{
return m_ValaszB;
}
set
{
CheckModifyable();
if (m_ValaszB == value) return;
m_ValaszB = value;
FieldModified("ValaszB", value);
}
}
#endregion
#region ValaszC
protected internal string m_ValaszC;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("ValaszC", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string ValaszC
{
get
{
return m_ValaszC;
}
set
{
CheckModifyable();
if (m_ValaszC == value) return;
m_ValaszC = value;
FieldModified("ValaszC", value);
}
}
#endregion
#region ValaszD
protected internal string m_ValaszD;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("ValaszD", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string ValaszD
{
get
{
return m_ValaszD;
}
set
{
CheckModifyable();
if (m_ValaszD == value) return;
m_ValaszD = value;
FieldModified("ValaszD", value);
}
}
#endregion
#region ValaszE
protected internal string m_ValaszE;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("ValaszE", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string ValaszE
{
get
{
return m_ValaszE;
}
set
{
CheckModifyable();
if (m_ValaszE == value) return;
m_ValaszE = value;
FieldModified("ValaszE", value);
}
}
#endregion
#region ValaszF
protected internal string m_ValaszF;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("ValaszF", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string ValaszF
{
get
{
return m_ValaszF;
}
set
{
CheckModifyable();
if (m_ValaszF == value) return;
m_ValaszF = value;
FieldModified("ValaszF", value);
}
}
#endregion
#region ValaszSzoveges
protected internal string m_ValaszSzoveges;
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
[EntityProperty("ValaszSzoveges", EntityPropertyBaseType.ValueType, typeof(string), EntityCopyMethod.ShallowCopy)]
public virtual string ValaszSzoveges
{
get
{
return m_ValaszSzoveges;
}
set
{
CheckModifyable();
if (m_ValaszSzoveges == value) return;
m_ValaszSzoveges = value;
FieldModified("ValaszSzoveges", value);
}
}
#endregion
#endregion
#region Asszociációkkal kapcsolatos dolgok
protected internal virtual bool LoadByErettsegiValaszId(int id)
{
return m_DA.LoadByErettsegiValaszId(id, this);
}
#region ErettsegiKerdes (*) -> Intezmeny (1)
protected internal int m_IntezmenyId = -1;
/// <summary>
/// A(z) Intezmeny asszociáció végpontjának ID-ja.
/// </summary>
/// <remarks>
/// - Insert() előtt célszerű kitölteni
/// - Update() nincs rá hatással: ezt a mezőt nem frissíti
/// - LoadByID() felhozza ezt a mezőt
/// </remarks>
public virtual int IntezmenyId
{
get
{
return InternalIntezmenyId;
}
set
{
InternalIntezmenyId = value;
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal int InternalIntezmenyId
{
get
{
if (m_Intezmeny != null)
{
return m_Intezmeny.ID;
}
else
{
return m_IntezmenyId;// XXX az meg nem teljesen OK
}
}
set
{
CheckModifyable();
if (m_IntezmenyId != value)
{
m_IntezmenyId = value;
m_Intezmeny = null;
FieldModified("IntezmenyId", value);
}
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal void ModifyIntezmeny(Intezmeny value)
{
m_IntezmenyId = value != null ? value.ID : -1;
m_Intezmeny = value;
FieldModified("IntezmenyId", value != null ? (object)value.ID : DBNull.Value);
}
protected internal void SetIntezmeny(Intezmeny value)
{
m_Intezmeny = value;
if (value != null)
{
m_IntezmenyId = value.ID;
}
else
{
m_IntezmenyId = -1;
}
}
protected Intezmeny m_Intezmeny = null;
IIntezmeny IErettsegiKerdes.Intezmeny
{
get { return Intezmeny; }
set { Intezmeny = value as Intezmeny; }
}
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
/// <remarks>
/// Az UML modellben szereplő ErettsegiKerdes és Intezmeny entitások közötti asszociáció megvalósítása.
/// </remarks>
[EntityProperty("Intezmeny", EntityPropertyBaseType.Entity, typeof(Intezmeny), EntityCopyMethod.ShallowCopy)]
public virtual Intezmeny Intezmeny
{
get
{
if ((m_Intezmeny == null) && (m_IntezmenyId != -1))
{
SDA.Kreta.Entities.Intezmeny partner = SDA.Kreta.Entities.Intezmeny.GiveAnInstance();
partner.LoadByID(m_IntezmenyId);
this.SetIntezmeny(partner);
}
// természetesen null-t adunk vissza, ha nem tudtunk felhozni semmit
return m_Intezmeny;
}
set
{
CheckModifyable();
if (value != null)
{
if ((m_Intezmeny == null) || (value.ID != m_Intezmeny.ID))
{
if (value.State != EntityState.Initialized)
{
throw new EntityStateException(value.State);
}
if ((this.State != EntityState.New))
{
// Lista van a másik oldalon, úgyhogy a lista DA-ját használjuk
SDA.Kreta.Entities.Intezmeny_ErettsegiKerdes_DA da = new Intezmeny_ErettsegiKerdes_DA(value);
da.AddItem(this);
this.SetIntezmeny(value);
}
else
{
this.SetIntezmeny(value);
}
FieldModified("IntezmenyId", value.ID);
}
}
else
{
// ki kell törölni a kapcsolatot az adatbázisban
this.SetIntezmeny(null);
UpdateAssociations();
FieldModified("IntezmenyId", DBNull.Value);
}
}
}
#endregion
#region ErettsegiKerdes (*) -> Tanev (1)
protected internal int m_TanevId = -1;
/// <summary>
/// A(z) Tanev asszociáció végpontjának ID-ja.
/// </summary>
/// <remarks>
/// - Insert() előtt célszerű kitölteni
/// - Update() nincs rá hatással: ezt a mezőt nem frissíti
/// - LoadByID() felhozza ezt a mezőt
/// </remarks>
public virtual int TanevId
{
get
{
return InternalTanevId;
}
set
{
InternalTanevId = value;
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal int InternalTanevId
{
get
{
if (m_Tanev != null)
{
return m_Tanev.ID;
}
else
{
return m_TanevId;// XXX az meg nem teljesen OK
}
}
set
{
CheckModifyable();
if (m_TanevId != value)
{
m_TanevId = value;
m_Tanev = null;
FieldModified("TanevId", value);
}
}
}
/// <summary>
/// Ez egy külön bejárat a DA számára
/// <summary>
internal void ModifyTanev(Tanev value)
{
m_TanevId = value != null ? value.ID : -1;
m_Tanev = value;
FieldModified("TanevId", value != null ? (object)value.ID : DBNull.Value);
}
protected internal void SetTanev(Tanev value)
{
m_Tanev = value;
if (value != null)
{
m_TanevId = value.ID;
}
else
{
m_TanevId = -1;
}
}
protected Tanev m_Tanev = null;
ITanev IErettsegiKerdes.Tanev
{
get { return Tanev; }
set { Tanev = value as Tanev; }
}
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
/// <remarks>
/// Az UML modellben szereplő ErettsegiKerdes és Tanev entitások közötti asszociáció megvalósítása.
/// </remarks>
[EntityProperty("Tanev", EntityPropertyBaseType.Entity, typeof(Tanev), EntityCopyMethod.ShallowCopy)]
public virtual Tanev Tanev
{
get
{
if ((m_Tanev == null) && (m_TanevId != -1))
{
SDA.Kreta.Entities.Tanev partner = SDA.Kreta.Entities.Tanev.GiveAnInstance();
partner.LoadByID(m_TanevId);
this.SetTanev(partner);
}
// természetesen null-t adunk vissza, ha nem tudtunk felhozni semmit
return m_Tanev;
}
set
{
CheckModifyable();
if (value != null)
{
if ((m_Tanev == null) || (value.ID != m_Tanev.ID))
{
if (value.State != EntityState.Initialized)
{
throw new EntityStateException(value.State);
}
if ((this.State != EntityState.New))
{
// Lista van a másik oldalon, úgyhogy a lista DA-ját használjuk
SDA.Kreta.Entities.Tanev_ErettsegiKerdes_DA da = new Tanev_ErettsegiKerdes_DA(value);
da.AddItem(this);
this.SetTanev(value);
}
else
{
this.SetTanev(value);
}
FieldModified("TanevId", value.ID);
}
}
else
{
// ki kell törölni a kapcsolatot az adatbázisban
this.SetTanev(null);
UpdateAssociations();
FieldModified("TanevId", DBNull.Value);
}
}
}
#endregion
#region ErettsegiKerdes (1) -> ErettsegiValasz (*)
protected IAssociatedEntityCollection<ErettsegiValasz> m_ErettsegiValasz = null;
IReadOnlyList<IErettsegiValasz> IErettsegiKerdes.ErettsegiValasz => ErettsegiValasz.Cast<IErettsegiValasz>().ToList();
/// <summary>
/// Nincs definiálva megjegyzés.
/// </summary>
/// <remarks>
/// Az UML modellben szereplő ErettsegiKerdes és ErettsegiValasz entitások közötti asszociáció megvalósítása.
/// </remarks>
[EntityProperty("ErettsegiValasz", EntityPropertyBaseType.EntityCollection, typeof(IAssociatedEntityCollection<ErettsegiValasz>), EntityCopyMethod.DeepCopy, "ErettsegiKerdesId")]
public virtual IAssociatedEntityCollection<ErettsegiValasz> ErettsegiValasz
{
get
{
if (m_ErettsegiValasz == null)
{
m_ErettsegiValasz = new AssociatedEntityCollection<ErettsegiKerdes, ErettsegiValasz>(
new ErettsegiKerdes_ErettsegiValasz_DA(this)
);
m_ErettsegiValasz.Load();
}
return m_ErettsegiValasz;
}
}
#endregion
#endregion
#endregion
}
}