ELENESSKI GAMES
  • Home
  • Games
    • Worzzler
    • The Lost Tribes
  • Unity
    • Facade Generator for Archimatix
    • Elenesski Object Database
    • Generic Move Camera
    • Unity C# Library
  • SQLINQ
    • Change Log
    • Concepts >
      • Overview
      • The Patterns
      • Database & Factories
      • Working with Tables
      • Custom Queries
      • Lazy Loading
      • Units of Work
    • Video Tutorials
    • Getting Started
    • Code Examples >
      • Implementing Behavior
      • Finding Objects
      • Custom Searches
      • Converters and Transformers
      • Object Association Management
      • New Objects
      • Creating Database
      • Associating Objects
      • Deleting Objects
      • Validating Objects
      • Saving
    • Sample Model >
      • Tutorial Model
      • Table Classes Code
      • Domain Classes Code
      • Factories Code
    • OSX Developers
    • Bridge Building
    • External Websites
    • Class Documentation
  • Presentations
    • 3D Ship Design
  • Music
    • Jamendo (Main)
    • Blend
    • Sound Cloud
    • Mixcloud (DJ)
    • DJ Demos
  • YouTube

table classes

Contains all of class code for supporting table loading.
  1. DistrictTable.cs
  2. PlanetTable.cs
  3. SettlementTable.cs

District Table.cs

//////////////////////////////////////////////////////////////////////////////////
// WARNING: This file contains generated code that can be replaced at any time
//          it's generated as a PARTIAL CLASS, so if you need to extend the class
//          implement your extensions in an alternate class that won't be overwritten.
//////////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Assets.SQLINQ.SQLite.Net;
using Assets.SQLINQ.SQLite.Patterns;
using Assets.Data.Utility;
using Assets.Data.DataDomain;

namespace Assets.Data.Tables {

    /// <summary>
    /// State or province on the planet.
    /// </summary>
    public partial class DistrictTable : IBaseTable {

        /// <summary>
        /// Unique identifier for the table
        /// </summary>
        [PrimaryKey, AutoIncrement]
        public int OID { get; set; }

        /// <summary>
        /// A string field used by a generated factor to differentiate one version of a
        /// subtype from another.  Used by the Single Table Inheritance pattern.
        /// </summary> 
        [MaxLength(20)]
        public string SubType { get; set; }

        //////////////////////////////////////////////////////////////
        // Attributes for - District
        //////////////////////////////////////////////////////////////       

        /// <summary>
        /// Name of the district.
        /// </summary>
        [MaxLength(50)]
        [Indexed]
        public string Name { get; set; }

        /// <summary>
        /// Default constructor.
        /// </summary>
        public DistrictTable() {
        }

        /// <summary>
        /// Use once when you create a new database.
        /// </summary>
        public static void CreateTable() {
            Repository.GetTemporaryDatabaseConnection().CreateTable<DistrictTable>();
        }

        /// <summary>
        /// Use to extract a row out of the table for a given OID.
        /// </summary>
        public static DistrictTable GetByOID(int aOID) {
            return Repository.GetTemporaryDatabaseConnection().Table<DistrictTable>().Where( IT => IT.OID == aOID ).FirstOrDefault();
        }

        /// <summary>
        /// Used to extract all the rows out of the given table.
        /// </summary>
        public static IEnumerable<DistrictTable> GetAll() {
            return Repository.GetTemporaryDatabaseConnection().Table<DistrictTable>();
        }

        //////////////////////////////////////////////////////////////
        // Find Methods - District
        //////////////////////////////////////////////////////////////       

        /// <summary>
        /// Use to find Name instances in the table in found order.
        /// </summary>
        public static IEnumerable<DistrictTable> FindByName(string aName) {
            return Repository.GetTemporaryDatabaseConnection().Table<DistrictTable>().Where( FIND => FIND.Name == aName );
        }
    }
}

Planet Table.cs

//////////////////////////////////////////////////////////////////////////////////
// WARNING: This file contains generated code that can be replaced at any time
//          it's generated as a PARTIAL CLASS, so if you need to extend the class
//          implement your extensions in an alternate class that won't be overwritten.
//////////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Assets.SQLINQ.SQLite.Net;
using Assets.SQLINQ.SQLite.Patterns;
using Assets.Data.Utility;
using Assets.Data.DataDomain;

namespace Assets.Data.Tables {

    /// <summary>
    /// Information about a planet.
    /// </summary>
    public partial class PlanetTable : IBaseTable {

        /// <summary>
        /// Unique identifier for the table
        /// </summary>
        [PrimaryKey, AutoIncrement]
        public int OID { get; set; }

        /// <summary>
        /// A string field used by a generated factor to differentiate one version of a
        /// subtype from another.  Used by the Single Table Inheritance pattern.
        /// </summary>  
        [MaxLength(20)]
        public string SubType { get; set; }

        //////////////////////////////////////////////////////////////
        // Attributes for - Planet
        //////////////////////////////////////////////////////////////        

        /// <summary>
        /// The name of the planet.
        /// </summary>
        [MaxLength(50)]
        [Indexed]
        public string Name { get; set; }

        /// <summary>
        /// Default constructor.
        /// </summary>
        public PlanetTable() {
        }

        /// <summary>
        /// Use once when you create a new database.
        /// </summary>
        public static void CreateTable() {
            Repository.GetTemporaryDatabaseConnection().CreateTable<PlanetTable>();
        }

        /// <summary>
        /// Use to extract a row out of the table for a given OID.
        /// </summary>
        public static PlanetTable GetByOID(int aOID) {
            return Repository.GetTemporaryDatabaseConnection().Table<PlanetTable>().Where( IT => IT.OID == aOID ).FirstOrDefault();
        }

        /// <summary>
        /// Used to extract all the rows out of the given table.
        /// </summary>
        public static IEnumerable<PlanetTable> GetAll() {
            return Repository.GetTemporaryDatabaseConnection().Table<PlanetTable>();
        }

        //////////////////////////////////////////////////////////////
        // Find Methods - Planet
        //////////////////////////////////////////////////////////////        

        /// <summary>
        /// Use to find Name instances in the table in found order.
        /// </summary>
        public static IEnumerable<PlanetTable> FindByName(string aName) {
            return Repository.GetTemporaryDatabaseConnection().Table<PlanetTable>().Where( FIND => FIND.Name == aName );
        }
    }
}

Settlement Table.cs

//////////////////////////////////////////////////////////////////////////////////
// WARNING: This file contains generated code that can be replaced at any time
//          it's generated as a PARTIAL CLASS, so if you need to extend the class
//          implement your extensions in an alternate class that won't be overwritten.
//////////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Assets.SQLINQ.SQLite.Net;
using Assets.SQLINQ.SQLite.Patterns;
using Assets.Data.Utility;
using Assets.Data.DataDomain;

namespace Assets.Data.Tables {

    /// <summary>
    /// Locations on the planet with peons.
    /// </summary>
    public partial class SettlementTable : IBaseTable {

        /// <summary>
        /// Unique identifier for the table
        /// </summary>
        [PrimaryKey, AutoIncrement]
        public int OID { get; set; }

        /// <summary>
        /// A string field used by a generated factor to differentiate one version of a
        /// subtype from another.  Used by the Single Table Inheritance pattern.
        /// </summary> 
        [MaxLength(20)]
        public string SubType { get; set; }

        //////////////////////////////////////////////////////////////
        // Attributes for - Settlement
        //////////////////////////////////////////////////////////////       

        /// <summary>
        /// Identifies the settlements on a planet.
        /// </summary> 
        public int ThePlanetOID { get; set; }

        /// <summary>
        /// Settlements in the district.
        /// </summary> 
        public int TheDistrictOID { get; set; }

        /// <summary>
        /// Name of the settlement.
        /// </summary>
        [MaxLength(50)]
        public string Name { get; set; }

        //////////////////////////////////////////////////////////////
        // Attributes for - Town
        //////////////////////////////////////////////////////////////       

        /// <summary>
        /// ** No comments found **
        /// </summary> 
        public int TheTypeOfTownOID { get; set; }

        /// <summary>
        /// The name of the ruler of the town.
        /// </summary>
        [MaxLength(50)]
        public string MayorName { get; set; }

        /// <summary>
        /// Historical or current state of town.
        /// </summary>
        public int TheTypeOfTown { get; set; }

        //////////////////////////////////////////////////////////////
        // Attributes for - City
        //////////////////////////////////////////////////////////////       

        /// <summary>
        /// The words to live by in the city.
        /// </summary>
        [MaxLength(250)]
        public string Motto { get; set; }

        /// <summary>
        /// Default constructor.
        /// </summary>
        public SettlementTable() {
        }

        /// <summary>
        /// Use once when you create a new database.
        /// </summary>
        public static void CreateTable() {
            Repository.GetTemporaryDatabaseConnection().CreateTable<SettlementTable>();
        }

        /// <summary>
        /// Use to extract a row out of the table for a given OID.
        /// </summary>
        public static SettlementTable GetByOID(int aOID) {
            return Repository.GetTemporaryDatabaseConnection().Table<SettlementTable>().Where( IT => IT.OID == aOID ).FirstOrDefault();
        }

        /// <summary>
        /// Used to extract all the rows out of the given table.
        /// </summary>
        public static IEnumerable<SettlementTable> GetAll() {
            return Repository.GetTemporaryDatabaseConnection().Table<SettlementTable>();
        }

        //////////////////////////////////////////////////////////////
        // Find Methods - Settlement
        //////////////////////////////////////////////////////////////       

        /// <summary>
        /// Use to find Name instances in the table in found order.
        /// </summary>
        public static IEnumerable<SettlementTable> FindByName(string aName) {
            return Repository.GetTemporaryDatabaseConnection().Table<SettlementTable>().Where( FIND => FIND.Name == aName );
        }

        //////////////////////////////////////////////////////////////
        // Find Methods - Town
        //////////////////////////////////////////////////////////////       

        //////////////////////////////////////////////////////////////
        // Find Methods - City
        //////////////////////////////////////////////////////////////       
    }
}