context: 
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  // This file was automatically generated by the PetaPoco T4 Template
  // Do not make changes directly to this file - edit the template instead
  // 
  // The following connection settings were used to generate this file
  // 
  //     Connection String Name: `LSREPConn`
  //     Provider:               `MySql.Data.MySqlClient`
  //     Connection String:      `server=ABYSSOSX;user id=lsdrepuser;password=**zapped**;database=lsdrep`
  //     Schema:                 `lsdrep`
  //     Include Views:          `False`
  
   
  
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using PetaPoco;
  
  namespace LaserSportDataObjects
  {
  
  	public partial class LSREPConnDB : Database 
  	{
  		public LSREPConnDB() 
  			: base("LSREPConn")
  		{
  			CommonConstruct();
  		}
  
  		public LSREPConnDB(string connectionStringName) 
  			: base(connectionStringName)
  		{
  			CommonConstruct();
  		}
  		
  		partial void CommonConstruct();
  		
  		public interface IFactory
  		{
  			LSREPConnDB GetInstance();
  		}
  		
  		public static IFactory Factory { get; set; }
          public static LSREPConnDB GetInstance()
          {
  			if (_instance!=null)
  				return _instance;
  				
  			if (Factory!=null)
  				return Factory.GetInstance();
  			else
  				return new LSREPConnDB();
          }
  
  		[ThreadStatic] static LSREPConnDB _instance;
  		
  		public override void OnBeginTransaction()
  		{
  			if (_instance==null)
  				_instance=this;
  		}
  		
  		public override void OnEndTransaction()
  		{
  			if (_instance==this)
  				_instance=null;
  		}
          
  
  		public class Record<T> where T:new()
  		{
  			public static LSREPConnDB repo { get { return LSREPConnDB.GetInstance(); } }
  			public bool IsNew() { return repo.IsNew(this); }
  			public object Insert() { return repo.Insert(this); }
  
  			public void Save() { repo.Save(this); }
  			public int Update() { return repo.Update(this); }
  
  			public int Update(IEnumerable<string> columns) { return repo.Update(this, columns); }
  			public static int Update(string sql, params object[] args) { return repo.Update<T>(sql, args); }
  			public static int Update(Sql sql) { return repo.Update<T>(sql); }
  			public int Delete() { return repo.Delete(this); }
  			public static int Delete(string sql, params object[] args) { return repo.Delete<T>(sql, args); }
  			public static int Delete(Sql sql) { return repo.Delete<T>(sql); }
  			public static int Delete(object primaryKey) { return repo.Delete<T>(primaryKey); }
  			public static bool Exists(object primaryKey) { return repo.Exists<T>(primaryKey); }
  			public static bool Exists(string sql, params object[] args) { return repo.Exists<T>(sql, args); }
  			public static T SingleOrDefault(object primaryKey) { return repo.SingleOrDefault<T>(primaryKey); }
  			public static T SingleOrDefault(string sql, params object[] args) { return repo.SingleOrDefault<T>(sql, args); }
  			public static T SingleOrDefault(Sql sql) { return repo.SingleOrDefault<T>(sql); }
  			public static T FirstOrDefault(string sql, params object[] args) { return repo.FirstOrDefault<T>(sql, args); }
  			public static T FirstOrDefault(Sql sql) { return repo.FirstOrDefault<T>(sql); }
  			public static T Single(object primaryKey) { return repo.Single<T>(primaryKey); }
  			public static T Single(string sql, params object[] args) { return repo.Single<T>(sql, args); }
  			public static T Single(Sql sql) { return repo.Single<T>(sql); }
  			public static T First(string sql, params object[] args) { return repo.First<T>(sql, args); }
  			public static T First(Sql sql) { return repo.First<T>(sql); }
  			public static List<T> Fetch(string sql, params object[] args) { return repo.Fetch<T>(sql, args); }
  			public static List<T> Fetch(Sql sql) { return repo.Fetch<T>(sql); }
  			public static List<T> Fetch(long page, long itemsPerPage, string sql, params object[] args) { return repo.Fetch<T>(page, itemsPerPage, sql, args); }
  			public static List<T> Fetch(long page, long itemsPerPage, Sql sql) { return repo.Fetch<T>(page, itemsPerPage, sql); }
  			public static List<T> SkipTake(long skip, long take, string sql, params object[] args) { return repo.SkipTake<T>(skip, take, sql, args); }
  			public static List<T> SkipTake(long skip, long take, Sql sql) { return repo.SkipTake<T>(skip, take, sql); }
  			public static Page<T> Page(long page, long itemsPerPage, string sql, params object[] args) { return repo.Page<T>(page, itemsPerPage, sql, args); }
  			public static Page<T> Page(long page, long itemsPerPage, Sql sql) { return repo.Page<T>(page, itemsPerPage, sql); }
  			public static IEnumerable<T> Query(string sql, params object[] args) { return repo.Query<T>(sql, args); }
  			public static IEnumerable<T> Query(Sql sql) { return repo.Query<T>(sql); }
  
  		}
  
  	}
  	
  
  
  
      
  	[TableName("lsevent_players")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class lsevent_player : LSREPConnDB.Record<lsevent_player>  , Ilsevent_player 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public int lsevent_id { get; set; }
  
  
  
  
  
  		[Column] public int player_id { get; set; }
  
  
  
  
  
  		[Column] public string alias { get; set; }
  
  
  
  
  
  		[Column] public int? team_id { get; set; }
  
  
  
  
  
  		[Column] public sbyte sort_order { get; set; }
  
  
  
  
  
  		[Column] public sbyte is_captain { get; set; }
  
  
  
  
  
  		[Column] public sbyte is_admin { get; set; }
  
  
  
  	}
  
      
  	[TableName("lsevents")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class lsevent : LSREPConnDB.Record<lsevent>  , Ilsevent 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public string lsevent_name { get; set; }
  
  
  
  
  
  		[Column] public DateTime? scheduled { get; set; }
  
  
  
  
  
  		[Column] public DateTime? actual { get; set; }
  
  
  
  
  
  		[Column] public string edit_code { get; set; }
  
  
  
  
  
  		[Column] public int? score_method_id { get; set; }
  
  
  
  	}
  
      
  	[TableName("match_player_hit_details")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class match_player_hit_detail : LSREPConnDB.Record<match_player_hit_detail>  , Imatch_player_hit_detail 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public int match_player_hit_id { get; set; }
  
  
  
  
  
  		[Column] public int target_type_id { get; set; }
  
  
  
  
  
  		[Column] public int hit_count { get; set; }
  
  
  
  
  
  		[Column] public decimal? score_override { get; set; }
  
  
  
  	}
  
      
  	[TableName("match_player_hits")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class match_player_hit : LSREPConnDB.Record<match_player_hit>  , Imatch_player_hit 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public int player_id { get; set; }
  
  
  
  
  
  		[Column] public decimal total_hits { get; set; }
  
  
  
  
  
  		[Column] public decimal front { get; set; }
  
  
  
  
  
  		[Column] public decimal back { get; set; }
  
  
  
  	}
  
      
  	[TableName("match_players")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class match_player : LSREPConnDB.Record<match_player>  , Imatch_player 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public int match_id { get; set; }
  
  
  
  
  
  		[Column] public int player_id { get; set; }
  
  
  
  
  
  		[Column] public decimal? score { get; set; }
  
  
  
  
  
  		[Column] public int? packset_detail_id { get; set; }
  
  
  
  	}
  
      
  	[TableName("match_teams")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class match_team : LSREPConnDB.Record<match_team>  , Imatch_team 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public int match_id { get; set; }
  
  
  
  
  
  		[Column] public int team_id { get; set; }
  
  
  
  
  
  		[Column] public decimal? score_override { get; set; }
  
  
  
  
  
  		[Column] public sbyte sort_order { get; set; }
  
  
  
  
  
  		[Column] public int? packset_id { get; set; }
  
  
  
  	}
  
      
  	[TableName("matches")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class match : LSREPConnDB.Record<match>  , Imatch 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public int lsevent_id { get; set; }
  
  
  
  
  
  		[Column] public string guid { get; set; }
  
  
  
  
  
  		[Column] public DateTime? scheduled { get; set; }
  
  
  
  
  
  		[Column] public DateTime? actual { get; set; }
  
  
  
  
  
  		[Column] public int? system_id { get; set; }
  
  
  
  
  
  		[Column] public int? series_id { get; set; }
  
  
  
  	}
  
      
  	[TableName("packset_details")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class packset_detail : LSREPConnDB.Record<packset_detail>  , Ipackset_detail 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public int packset_id { get; set; }
  
  
  
  
  
  		[Column] public string pack_id { get; set; }
  
  
  
  	}
  
      
  	[TableName("packsets")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class packset : LSREPConnDB.Record<packset>  , Ipackset 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public int lsevent_id { get; set; }
  
  
  
  
  
  		[Column] public int? series_id { get; set; }
  
  
  
  
  
  		[Column] public string descr { get; set; }
  
  
  
  
  
  		[Column] public string color { get; set; }
  
  
  
  	}
  
      
  	[TableName("players")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class player : LSREPConnDB.Record<player>  , Iplayer 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public string code_name { get; set; }
  
  
  
  
  
  		[Column] public string first_name { get; set; }
  
  
  
  
  
  		[Column] public string last_name { get; set; }
  
  
  
  
  
  		[Column] public sbyte is_admin { get; set; }
  
  
  
  	}
  
      
  	[TableName("score_methods")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class score_method : LSREPConnDB.Record<score_method>  , Iscore_method 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public string name { get; set; }
  
  
  
  
  
  		[Column] public string proc { get; set; }
  
  
  
  
  
  		[Column] public string code { get; set; }
  
  
  
  	}
  
      
  	[TableName("series")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class series : LSREPConnDB.Record<series>  , Iseries 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public int lsevent_id { get; set; }
  
  
  
  
  
  		[Column] public string name { get; set; }
  
  
  
  	}
  
      
  	[TableName("system_metadatadefs")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class system_metadatadef : LSREPConnDB.Record<system_metadatadef>  , Isystem_metadatadef 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public int system_id { get; set; }
  
  
  
  
  
  		[Column] public string field_name { get; set; }
  
  
  
  
  
  		[Column] public sbyte sort_order { get; set; }
  
  
  
  
  
  		[Column] public sbyte? decimal_places { get; set; }
  
  
  
  	}
  
      
  	[TableName("system_target_types")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class system_target_type : LSREPConnDB.Record<system_target_type>  , Isystem_target_type 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public int system_id { get; set; }
  
  
  
  
  
  		[Column] public int target_type_id { get; set; }
  
  
  
  
  
  		[Column] public decimal? hit_for_point_value { get; set; }
  
  
  
  
  
  		[Column] public decimal? hit_against_point_value { get; set; }
  
  
  
  
  
  		[Column] public int sort_order { get; set; }
  
  
  
  	}
  
      
  	[TableName("systems")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class system : LSREPConnDB.Record<system>  , Isystem 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public string system_name { get; set; }
  
  
  
  	}
  
      
  	[TableName("target_types")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class target_type : LSREPConnDB.Record<target_type>  , Itarget_type 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public string code { get; set; }
  
  
  
  
  
  		[Column] public string name { get; set; }
  
  
  
  
  
  		[Column] public string descr { get; set; }
  
  
  
  
  
  		[Column] public int sort_order { get; set; }
  
  
  
  
  
  		[Column] public decimal? point_value { get; set; }
  
  
  
  	}
  
      
  	[TableName("teams")]
  
  
  	[PrimaryKey("id")]
  
  
  
  	[ExplicitColumns]
      public partial class team : LSREPConnDB.Record<team>  , Iteam 
      {
  
  
  
  		[Column] public int id { get; set; }
  
  
  
  
  
  		[Column] public int lsevent_id { get; set; }
  
  
  
  
  
  		[Column] public string team_name { get; set; }
  
  
  
  	}
  
  
  }
  
   
   
  //Generate Interfaces
  public interface Ilsevent_player
  {
  	int id { get; set; }
  	int lsevent_id { get; set; }
  	int player_id { get; set; }
  	string alias { get; set; }
  	int? team_id { get; set; }
  	sbyte sort_order { get; set; }
  	sbyte is_captain { get; set; }
  	sbyte is_admin { get; set; }
  }
  public interface Ilsevent
  {
  	int id { get; set; }
  	string lsevent_name { get; set; }
  	DateTime? scheduled { get; set; }
  	DateTime? actual { get; set; }
  	string edit_code { get; set; }
  	int? score_method_id { get; set; }
  }
  public interface Imatch_player_hit_detail
  {
  	int id { get; set; }
  	int match_player_hit_id { get; set; }
  	int target_type_id { get; set; }
  	int hit_count { get; set; }
  	decimal? score_override { get; set; }
  }
  public interface Imatch_player_hit
  {
  	int id { get; set; }
  	int player_id { get; set; }
  	decimal total_hits { get; set; }
  	decimal front { get; set; }
  	decimal back { get; set; }
  }
  public interface Imatch_player
  {
  	int id { get; set; }
  	int match_id { get; set; }
  	int player_id { get; set; }
  	decimal? score { get; set; }
  	int? packset_detail_id { get; set; }
  }
  public interface Imatch_team
  {
  	int id { get; set; }
  	int match_id { get; set; }
  	int team_id { get; set; }
  	decimal? score_override { get; set; }
  	sbyte sort_order { get; set; }
  	int? packset_id { get; set; }
  }
  public interface Imatch
  {
  	int id { get; set; }
  
gt: 	int lsevent_id { get; set; }