//======================================================================== // This file was generated using the MyGeneration tool in combination // with the Gentle.NET Business Entity template, $Rev: 44g JC$ //======================================================================== using System; using System.Collections; using Gentle.Framework; using Gentle.Common.Attributes; namespace WideSolutions.Data.Restaunet { #region Fontes /// /// This object represents the properties and methods of a Employee. /// [Serializable] [TableName("Fontes")] public class Fontes : Persistent { #region Members private bool _changed = false; private static bool invalidatedListAll = true; private static ArrayList listAllCache = null; /***PRESERVE_BEGIN MANUAL_CODE_Fonte***//***PRESERVE_END MANUAL_CODE_Fonte***/ [TableColumn("ID", NotNull = false), PrimaryKey(AutoGenerated = false)] protected int iD; /***PRESERVE_BEGIN MANUAL_CODE_Nome***//***PRESERVE_END MANUAL_CODE_Nome***/ [TableColumn("Nome", NotNull=false)] protected string nome; #endregion #region Constructors /// /// Create a new object using the minimum required information (all not-null fields except /// auto-generated primary keys). /// public Fontes( int ID) { _changed = true; invalidatedListAll = true; iD = ID; } /// /// Create an object from an existing row of data. This will be used by Gentle to /// construct objects from retrieved rows. /// public Fontes( int ID, string Nome) { iD = ID; nome = Nome; } #endregion #region Public Properties public bool Changed { get { return _changed; } } public int ID { get{ return iD; } set{ _changed |= iD != value; iD = value; invalidatedListAll = _changed;} } public string Nome { get{ return nome; } set{ _changed |= nome != value; nome = value; invalidatedListAll = _changed;} } // generate a static property to retrieve all instances of a class that are stored in the database static public IList ListAll() { if( listAllCache == null || invalidatedListAll ) { listAllCache = Broker.RetrieveList( typeof(Fontes) ) as ArrayList; invalidatedListAll = false; } return listAllCache; } // static property to retrieve all instances of a class that are stored in the database as a TypedArrayList [Visible(false)] static public Gentle.Common.TypedArrayList ListAllTyped { get { Gentle.Common.TypedArrayList tList = new Gentle.Common.TypedArrayList( typeof(Fontes) ); // populate list (note: ObjectFactory.GetCollection supports a similar syntax) Broker.RetrieveList( typeof(Fontes), tList ); return tList; } } // static property to retrieve all instances of a class that are stored in the database as a DataView [Visible(false)] static public System.Data.DataView ViewAll { get{ SqlBuilder sb = new SqlBuilder( StatementType.Select, typeof(Fontes) ); SqlResult sr = sb.GetStatement().Execute(); return ObjectView.GetDataView( sr ); } } // static method that returns an instance of the object searching for a especif columns static public SqlResult FindBy(string _propertie,object _prop_value) { SqlBuilder sb = new SqlBuilder( StatementType.Select, typeof(Fontes) ); sb.AddConstraint(Operator.Equals,_propertie,_prop_value); SqlResult sr = sb.GetStatement().Execute(); return sr; } // static method that returns an instance of the object searching for a especif columns with a specific operator static public SqlResult FindBy(Operator _op,string _propertie,object _prop_value) { SqlBuilder sb = new SqlBuilder( StatementType.Select, typeof(Fontes) ); sb.AddConstraint(_op ,_propertie,_prop_value); SqlResult sr = sb.GetStatement().Execute(); return sr; } #endregion #region Debug Properties /// /// Generated only when genDebug flag enabled in MyGeneration template UI /// Returns number of items in internal cache /// public static int CacheCount { get{ return listAllCache == null ? 0 : listAllCache.Count;} } #endregion #region Storage and retrieval public static Fontes Retrieve(int id ) { Key key = new Key( typeof(Fontes), true, "ID", id ); return Broker.RetrieveInstance( typeof(Fontes), key ) as Fontes; } //Gentle.NET Business Entity script: Generation of complex retrieve function (multiple primary keys) is not implemented yet. public override void Persist() { if( Changed || !IsPersisted ) { base.Persist(); _changed=false; } } public override void Remove() { base.Remove(); invalidatedListAll = true; } #endregion #region Relations // List of primary keys for this class table // Key: ID // List of foreign keys for this class table // Key: FK_DicasSugestoes_Fontes primary table: Fontes primary column: ID foreign column: Fonte foreign table: DicasSugestoes // Key: FK_Receita_Fontes primary table: Fontes primary column: ID foreign column: Fonte foreign table: Receita // Key: FK_Roteiros_Fontes primary table: Fontes primary column: ID foreign column: Fonte foreign table: Roteiros // List of selected relation tables for this database // Table: dtproperties // Table: Alimentos // Table: CedidoPor // Table: Classificacoes // Table: Concelho // Table: Concorrente // Table: DDicas_Alimentos // Table: DDicas_Culinaria // Table: DicasSugestoes // Table: Distrito // Table: DMenuSemana // Table: DReceitaDia // Table: DRoteiroMes // Table: Fontes // Table: Glossario // Table: Ingredientes // Table: LisboaProva // Table: Login // Table: MailingList // Table: MailingList_Clientes // Table: MailingList_Testes // Table: MContactos // Table: MPublicidade // Table: MyReceitas // Table: MyRestaurantes // Table: MyRoteiros // Table: Pais // Table: Perguntas // Table: PicanoChao // Table: Picanochao_backup // Table: Portal Jovem // Table: PrecoMedio // Table: Principedocalhariz // Table: Promocoes // Table: QuestRestaunet // Table: Quintadosfrades // Table: Receita // Table: Regiao // Table: Registos // Table: Respostas // Table: Respostas_Concorrente // Table: RestauClientes // Table: RestauClientes_Imagens // Table: Restaurantes // Table: Restaurantes_Comentarios // Table: Restaurantes_Horario // Table: Restaurantes_Ocasiao // Table: Restaurantes_TipoCozinha // Table: Restaurantes_TipoRestaurante // Table: RM // Table: Roteiros // Table: Staff // Table: Sugestoes // Table: TipoAlimento // Table: TipoCozinha // Table: TipoData // Table: TipoDicas // Table: TipoEntidade // Table: TipoOcasiao // Table: TipoPacote // Table: TipoPrato // Table: TipoPreparacao // Table: TipoPromocao // Table: TipoRestaurantes // Table: TipoUtensilio // Table: Utensilios // Table: Varandadomarques /// /// Return list of referenced objects from n:m relation with /// table "DMenuSemana", using relation table "Receita" /// public IList referencedDMenuSemanaUsingReceita() { return new GentleList( typeof(DMenuSemana), this, typeof(Receita)); } /// /// Return list of referenced objects from n:m relation with /// table "DMenuSemana", using relation table "Receita" /// public IList referencedDMenuSemanaUsingReceita() { return new GentleList( typeof(DMenuSemana), this, typeof(Receita)); } /// /// Return list of referenced objects from n:m relation with /// table "DMenuSemana", using relation table "Receita" /// public IList referencedDMenuSemanaUsingReceita() { return new GentleList( typeof(DMenuSemana), this, typeof(Receita)); } /// /// Return list of referenced objects from n:m relation with /// table "DReceitaDia", using relation table "Receita" /// public IList referencedDReceitaDiaUsingReceita() { return new GentleList( typeof(DReceitaDia), this, typeof(Receita)); } /// /// Return list of referenced objects from n:m relation with /// table "MyReceitas", using relation table "Receita" /// public IList referencedMyReceitasUsingReceita() { return new GentleList( typeof(MyReceitas), this, typeof(Receita)); } /// /// Return list of referenced objects from n:m relation with /// table "CedidoPor", using relation table "Receita" /// public IList referencedCedidoPorUsingReceita() { return new GentleList( typeof(CedidoPor), this, typeof(Receita)); } /// /// Return list of referenced objects from n:m relation with /// table "Ingredientes", using relation table "Receita" /// public IList referencedIngredientesUsingReceita() { return new GentleList( typeof(Ingredientes), this, typeof(Receita)); } /// /// Return list of referenced objects from n:m relation with /// table "Staff", using relation table "Receita" /// public IList referencedStaffUsingReceita() { return new GentleList( typeof(Staff), this, typeof(Receita)); } /// /// Return list of referenced objects from n:m relation with /// table "MyRoteiros", using relation table "Roteiros" /// public IList referencedMyRoteirosUsingRoteiros() { return new GentleList( typeof(MyRoteiros), this, typeof(Roteiros)); } /// /// Return list of referenced objects from n:m relation with /// table "Regiao", using relation table "Roteiros" /// public IList referencedRegiaoUsingRoteiros() { return new GentleList( typeof(Regiao), this, typeof(Roteiros)); } /// /// Return list of referenced objects from n:m relation with /// table "Staff", using relation table "Roteiros" /// public IList referencedStaffUsingRoteiros() { return new GentleList( typeof(Staff), this, typeof(Roteiros)); } #endregion #region ManualCode /***PRESERVE_BEGIN MANUAL_CODE***//***PRESERVE_END MANUAL_CODE***/ #endregion } #endregion }