Initial commit
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
[*.cs]
|
||||
|
||||
# IDE0063: Use simple 'using' statement
|
||||
csharp_prefer_simple_using_statement = false:suggestion
|
||||
+357
@@ -0,0 +1,357 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
[Ww][Ii][Nn]32/
|
||||
[Aa][Rr][Mm]/
|
||||
[Aa][Rr][Mm]64/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUnit
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
nunit-*.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# ASP.NET Scaffolding
|
||||
ScaffoldingReadMe.txt
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_h.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*_wpftmp.csproj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Coverlet is a free, cross platform Code Coverage Tool
|
||||
coverage*[.json, .xml, .info]
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# NuGet Symbol Packages
|
||||
*.snupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
*.appxbundle
|
||||
*.appxupload
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!?*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- [Bb]ackup.rdl
|
||||
*- [Bb]ackup ([0-9]).rdl
|
||||
*- [Bb]ackup ([0-9][0-9]).rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# CodeRush personal settings
|
||||
.cr/personal
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
|
||||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
# Ionide (cross platform F# VS Code tools) working folder
|
||||
.ionide/
|
||||
Binary file not shown.
@@ -0,0 +1,72 @@
|
||||
using AutoBet.ApiGenerator.Extensions;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace AutoBet.ApiGenerator
|
||||
{
|
||||
internal class ApiClassessGenerator
|
||||
{
|
||||
public string _inputXmlFile { get; }
|
||||
public string _outputFilesDirectory { get; }
|
||||
|
||||
public ApiClassessGenerator(string inputXmlFile, string outputFilesDirectory)
|
||||
{
|
||||
_inputXmlFile = inputXmlFile;
|
||||
_outputFilesDirectory = outputFilesDirectory;
|
||||
}
|
||||
|
||||
internal void Process(string namespaceValue, string modelFolder)
|
||||
{
|
||||
var doc = XDocument.Load(_inputXmlFile);
|
||||
var nodes = doc.Root.Elements("dataType");
|
||||
namespaceValue += "." + modelFolder;
|
||||
var modelsDirectory = Path.Combine(_outputFilesDirectory, modelFolder);
|
||||
Directory.CreateDirectory(modelsDirectory);
|
||||
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
CSharpClassBuilder.UsingHeader(sb, namespaceValue, namespaceValue + ".Enums");
|
||||
var descriptionNode = node.Element("description");
|
||||
if (descriptionNode != null && !String.IsNullOrWhiteSpace(descriptionNode.Value))
|
||||
{
|
||||
CSharpClassBuilder.Summary(sb, descriptionNode.Value, isClassSummary: true);
|
||||
}
|
||||
|
||||
var name = node.Attribute("name").Value;
|
||||
CSharpClassBuilder.ClassHeader(sb, name);
|
||||
var parameters = node.Elements("parameter");
|
||||
foreach(var parameter in parameters)
|
||||
{
|
||||
sb.AppendWithIndent(8, "public ");
|
||||
var parameterReturnType = CSharpClassBuilder.GetDataType(parameter.Attribute("type").Value);
|
||||
sb.Append(parameterReturnType);
|
||||
sb.Append(" ");
|
||||
var parameterName = parameter.Attribute("name").Value;
|
||||
for(var i = 0; i < parameterName.Length; i++)
|
||||
{
|
||||
if(i == 0)
|
||||
{
|
||||
sb.Append(Char.ToUpper(parameterName[i]));
|
||||
continue;
|
||||
}
|
||||
|
||||
sb.Append(parameterName[i]);
|
||||
}
|
||||
sb.Append(" { get; set; }");
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
CSharpClassBuilder.ClassFooter(sb);
|
||||
CSharpClassBuilder.UsingFooter(sb);
|
||||
|
||||
File.WriteAllText(Path.Combine(modelsDirectory, $"{name}.cs"), sb.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
using AutoBet.ApiGenerator.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace AutoBet.ApiGenerator
|
||||
{
|
||||
internal class ApiClientGenetaor
|
||||
{
|
||||
private string _inputXmlFile { get; }
|
||||
private string _outputFilesDirectory { get; }
|
||||
|
||||
public ApiClientGenetaor(string inputXmlFile, string outputFilesDirectory)
|
||||
{
|
||||
_inputXmlFile = inputXmlFile;
|
||||
_outputFilesDirectory = outputFilesDirectory;
|
||||
}
|
||||
|
||||
public void Process(string apiClientName, string namespaceValue)
|
||||
{
|
||||
var doc = XDocument.Load(_inputXmlFile);
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine("using System;");
|
||||
sb.AppendLine("using System.Collections.Generic;");
|
||||
sb.AppendLine("using System.Net.Http;");
|
||||
sb.AppendLine("using System.Net.Http.Headers;");
|
||||
sb.AppendLine("using System.Text;");
|
||||
sb.AppendLine("using System.Threading.Tasks;");
|
||||
sb.AppendFormat("using {0}.{1}{2};", namespaceValue, apiClientName, "Models");
|
||||
sb.AppendLine();
|
||||
sb.AppendFormat("using {0}.{1}{2};", namespaceValue, apiClientName, "Models.Enums");
|
||||
sb.AppendLine();
|
||||
sb.AppendLine();
|
||||
sb.Append("namespace ");
|
||||
sb.Append(namespaceValue);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("{");
|
||||
sb.AppendWithIndent(4, "public class ");
|
||||
sb.Append(apiClientName);
|
||||
sb.Append("ApiClient");
|
||||
sb.AppendLine();
|
||||
sb.AppendWithIndent(4, "{\r\n");
|
||||
|
||||
var nodes = doc.Root.Elements("operation");
|
||||
foreach(var node in nodes)
|
||||
{
|
||||
AppendDescription(sb, node);
|
||||
|
||||
sb.AppendWithIndent(8, "public ");
|
||||
var paramaeters = node.Element("parameters");
|
||||
var response = paramaeters.Element("simpleResponse");
|
||||
sb.Append("async Task<");
|
||||
var returnType = CSharpClassBuilder.GetDataType(response.Attribute("type").Value);
|
||||
sb.Append(returnType);
|
||||
sb.Append("> ");
|
||||
var camelcaseMethodName = node.Attribute("name").Value;
|
||||
var methodName = GetMethodName(camelcaseMethodName);
|
||||
sb.Append(methodName);
|
||||
var parametersAppended = AppendParameters(sb, paramaeters.Element("request"));
|
||||
sb.AppendWithIndent(8, "{\r\n");
|
||||
AppendMethodBody(sb, returnType, camelcaseMethodName + "/", parametersAppended);
|
||||
sb.AppendWithIndent(8, "}\r\n\r\n");
|
||||
}
|
||||
sb.Remove(sb.Length - 2, 2);
|
||||
sb.AppendWithIndent(4, "}\r\n");
|
||||
sb.Append("}");
|
||||
File.WriteAllText(Path.Combine(_outputFilesDirectory, $"{apiClientName}ApiClient.cs"), sb.ToString());
|
||||
}
|
||||
|
||||
private void AppendMethodBody(StringBuilder sb, string returnType, string endpoint, string[] paramaters)
|
||||
{
|
||||
var request = "";
|
||||
if(paramaters.Length > 0)
|
||||
{
|
||||
sb.AppendWithIndent(12, "var request = new\r\n");
|
||||
sb.AppendWithIndent(12, "{\r\n");
|
||||
foreach (var parameter in paramaters)
|
||||
{
|
||||
sb.AppendWithIndent(16, parameter);
|
||||
sb.Append(",\r\n");
|
||||
}
|
||||
sb.Remove(sb.Length - 3, 3);
|
||||
sb.Append("\r\n");
|
||||
sb.AppendWithIndent(12, "};\r\n");
|
||||
request = ", request";
|
||||
}
|
||||
sb.AppendWithIndent(12, "var result = await ExecuteRequest<");
|
||||
sb.Append(returnType);
|
||||
sb.Append(">(_endpoint + \"");
|
||||
sb.Append(endpoint);
|
||||
sb.Append("\"");
|
||||
sb.Append(request);
|
||||
sb.Append(");\r\n");
|
||||
sb.AppendWithIndent(12, "return result;\r\n");
|
||||
}
|
||||
|
||||
private string[] AppendParameters(StringBuilder sb, XElement request)
|
||||
{
|
||||
var paramatersAppended = new List<string>();
|
||||
sb.Append("(");
|
||||
var parameters = request.Elements("parameter");
|
||||
foreach (var parameter in parameters)
|
||||
{
|
||||
var name = parameter.Attribute("name").Value;
|
||||
var type = CSharpClassBuilder.GetDataType(parameter.Attribute("type").Value);
|
||||
sb.Append(type);
|
||||
|
||||
var mandatory = parameter.Attribute("mandatory");
|
||||
var isRequired = mandatory != null && mandatory.Value != null && mandatory.Value == "true";
|
||||
if (!isRequired && (type == "int" || type == "long" || type == "bool"))
|
||||
{
|
||||
sb.Append("?");
|
||||
}
|
||||
|
||||
sb.Append(" ");
|
||||
|
||||
sb.Append(name);
|
||||
|
||||
if (!isRequired)
|
||||
{
|
||||
sb.Append(" = null");
|
||||
}
|
||||
|
||||
paramatersAppended.Add(name);
|
||||
sb.Append(", ");
|
||||
}
|
||||
if(parameters.Any())
|
||||
{
|
||||
sb.Remove(sb.Length - 2, 2);
|
||||
}
|
||||
|
||||
sb.Append(")\r\n");
|
||||
return paramatersAppended.ToArray();
|
||||
}
|
||||
|
||||
private void AppendDescription(StringBuilder sb, XElement node)
|
||||
{
|
||||
var description = node.Element("description").Value;
|
||||
if (!String.IsNullOrWhiteSpace(description))
|
||||
{
|
||||
CSharpClassBuilder.Summary(sb, description);
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetMethodName(string methodName)
|
||||
{
|
||||
return Char.ToUpper(methodName[0]).ToString() + methodName.Substring(1, methodName.Length - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
using AutoBet.ApiGenerator.Extensions;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace AutoBet.ApiGenerator
|
||||
{
|
||||
internal class ApiEnumsGenerator
|
||||
{
|
||||
public string _inputXmlFile { get; }
|
||||
public string _outputFilesDirectory { get; }
|
||||
|
||||
public ApiEnumsGenerator(string inputXmlFile, string outputFilesDirectory)
|
||||
{
|
||||
_inputXmlFile = inputXmlFile;
|
||||
_outputFilesDirectory = outputFilesDirectory;
|
||||
}
|
||||
|
||||
internal void Process(string namespaceValue, string modelFolder, string enumFolder)
|
||||
{
|
||||
var doc = XDocument.Load(_inputXmlFile);
|
||||
var nodes = doc.Root.Elements("simpleType");
|
||||
namespaceValue += $".{modelFolder}.{enumFolder}";
|
||||
var enumsDirectory = Path.Combine(_outputFilesDirectory, modelFolder, enumFolder);
|
||||
Directory.CreateDirectory(enumsDirectory);
|
||||
|
||||
foreach (var node in nodes)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
|
||||
CSharpClassBuilder.UsingHeader(sb, namespaceValue, "System.Runtime.Serialization");
|
||||
var descriptionNode = node.Element("description");
|
||||
if (descriptionNode != null && !String.IsNullOrWhiteSpace(descriptionNode.Value))
|
||||
{
|
||||
CSharpClassBuilder.Summary(sb, descriptionNode.Value, isClassSummary: true);
|
||||
}
|
||||
|
||||
var name = node.Attribute("name").Value;
|
||||
CSharpClassBuilder.EnumHeader(sb, name);
|
||||
var validValues = node.Element("validValues");
|
||||
if (validValues == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var enumValues = validValues.Elements("value");
|
||||
foreach(var enumValue in enumValues)
|
||||
{
|
||||
var parameterName = enumValue.Attribute("name").Value;
|
||||
sb.AppendWithIndent(8, "");
|
||||
sb.AppendFormat("[EnumMember(Value = \"{0}\")]", parameterName);
|
||||
sb.AppendLine();
|
||||
sb.AppendWithIndent(8, "");
|
||||
|
||||
var upperCaseNextLetter = true;
|
||||
for (var i = 0; i < parameterName.Length; i++)
|
||||
{
|
||||
if (upperCaseNextLetter)
|
||||
{
|
||||
upperCaseNextLetter = false;
|
||||
sb.Append(Char.ToUpper(parameterName[i]));
|
||||
continue;
|
||||
}
|
||||
|
||||
if(parameterName[i] == '_')
|
||||
{
|
||||
upperCaseNextLetter = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
sb.Append(Char.ToLower(parameterName[i]));
|
||||
}
|
||||
sb.Append(',');
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.Remove(sb.Length - 3, 3);
|
||||
sb.AppendLine();
|
||||
CSharpClassBuilder.ClassFooter(sb);
|
||||
CSharpClassBuilder.UsingFooter(sb);
|
||||
|
||||
File.WriteAllText(Path.Combine(enumsDirectory, $"{name}.cs"), sb.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="SuccessfulCodeTools" Version="1.0.8" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,103 @@
|
||||
using AutoBet.ApiGenerator.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace AutoBet.ApiGenerator
|
||||
{
|
||||
public static class CSharpClassBuilder
|
||||
{
|
||||
public static void Summary(StringBuilder sb, string summary, bool isClassSummary = false)
|
||||
{
|
||||
var indentSpaces = isClassSummary ? 4 : 8;
|
||||
if (!String.IsNullOrWhiteSpace(summary))
|
||||
{
|
||||
sb.AppendWithIndent(indentSpaces, "/// <summary>\r\n");
|
||||
|
||||
var descriptionLines = summary.Trim().TrimEnd('\n').Replace("\r", "").Split('\n');
|
||||
foreach (var line in descriptionLines)
|
||||
{
|
||||
sb.AppendWithIndent(indentSpaces, "/// ");
|
||||
sb.Append(line.Trim());
|
||||
sb.AppendLine();
|
||||
}
|
||||
sb.AppendWithIndent(indentSpaces, "/// </summary>\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
public static void ClassFooter(StringBuilder sb)
|
||||
{
|
||||
sb.AppendWithIndent(4, "}");
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
public static void ClassHeader(StringBuilder sb, string name)
|
||||
{
|
||||
sb.AppendWithIndent(4, "public class ");
|
||||
sb.Append(name);
|
||||
sb.AppendLine();
|
||||
sb.AppendWithIndent(4, "{");
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
public static void EnumHeader(StringBuilder sb, string name)
|
||||
{
|
||||
sb.AppendWithIndent(4, "public enum ");
|
||||
sb.Append(name);
|
||||
sb.AppendLine();
|
||||
sb.AppendWithIndent(4, "{");
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
public static void UsingHeader(StringBuilder sb, string namespaceValue, params string[] usings)
|
||||
{
|
||||
sb.AppendLine("using System;");
|
||||
foreach (var value in usings)
|
||||
{
|
||||
sb.AppendFormat("using {0};", value);
|
||||
sb.AppendLine();
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
sb.Append("namespace ");
|
||||
sb.Append(namespaceValue);
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("{");
|
||||
}
|
||||
|
||||
public static void UsingFooter(StringBuilder sb)
|
||||
{
|
||||
sb.Append("}");
|
||||
}
|
||||
|
||||
public static string GetDataType(string responseType)
|
||||
{
|
||||
if (responseType.StartsWith("list("))
|
||||
{
|
||||
return GetCSharpType(responseType.Substring(5, responseType.Length - 6)) + "[]";
|
||||
}
|
||||
|
||||
if (responseType.StartsWith("set("))
|
||||
{
|
||||
return GetCSharpType(responseType.Substring(4, responseType.Length - 5)) + "[]";
|
||||
}
|
||||
|
||||
return GetCSharpType(responseType);
|
||||
}
|
||||
|
||||
private static string GetCSharpType(string responseType)
|
||||
{
|
||||
switch (responseType)
|
||||
{
|
||||
case "i64":
|
||||
return "long";
|
||||
case "i32":
|
||||
return "int";
|
||||
case "dateTime":
|
||||
return "DateTime";
|
||||
default:
|
||||
return responseType;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace AutoBet.ApiGenerator.Extensions
|
||||
{
|
||||
internal static class StringBuilderExtensions
|
||||
{
|
||||
public static void AppendWithIndent(this StringBuilder sb, int spaces, string value = null)
|
||||
{
|
||||
for (var i = 0; i < spaces; i++)
|
||||
{
|
||||
sb.Append(" ");
|
||||
}
|
||||
|
||||
if(value != null)
|
||||
{
|
||||
sb.Append(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
|
||||
namespace AutoBet.ApiGenerator
|
||||
{
|
||||
public static class Program
|
||||
{
|
||||
private static string _inputXmlFile;
|
||||
private static string _outputFilesDirectory;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
//ProccessArguments(args);
|
||||
//var namespaceValue = "SuccessfulCode.BetfairApi";
|
||||
//var clientName = "Betting";
|
||||
////var apiClientGenerator = new ApiClientGenetaor(_inputXmlFile, _outputFilesDirectory);
|
||||
////apiClientGenerator.Process(clientName, namespaceValue);
|
||||
////var apiClassesGenerator = new ApiClassessGenerator(_inputXmlFile, _outputFilesDirectory);
|
||||
////apiClassesGenerator.Process(namespaceValue, clientName + "Models");
|
||||
////var apiEnumsGenerator = new ApiEnumsGenerator(_inputXmlFile, _outputFilesDirectory);
|
||||
////apiEnumsGenerator.Process(namespaceValue, clientName + "Models", "Enums");
|
||||
}
|
||||
|
||||
private static void ProccessArguments(string[] args)
|
||||
{
|
||||
for (var i = 0; i < args.Length; i++)
|
||||
{
|
||||
switch (args[i])
|
||||
{
|
||||
case "-i":
|
||||
_inputXmlFile = args[++i];
|
||||
break;
|
||||
|
||||
case "-d":
|
||||
_outputFilesDirectory = args[++i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"profiles": {
|
||||
"AutoBet.ApiGenerator": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "-i \"E:\\Betfair\\bettingapi.xml\" -d \"C:\\Users\\Martin\\Documents\\Visual Studio 2017\\Projects\\AutoBet\\SuccessfulCode.BetfairApi\""
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="SuccessfulCodeTools" Version="1.0.8" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AutoBet.Core\AutoBet.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="..\.editorconfig" Link=".editorconfig" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="SuccessfulCode.BetfairApi" Version="1.0.11" />
|
||||
<PackageReference Include="SuccessfulCodeTools" Version="1.0.8" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,173 @@
|
||||
//using SuccessfulCode.BetfairApi;
|
||||
//using SuccessfulCode.BetfairApi.BettingModels;
|
||||
//using SuccessfulCode.BetfairApi.BettingModels.Enums;
|
||||
//using Microsoft.EntityFrameworkCore;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Linq;
|
||||
//using System.Threading.Tasks;
|
||||
//using System.Dynamic;
|
||||
|
||||
//namespace AutoBet.Core
|
||||
//{
|
||||
// public class AutoBetBot
|
||||
// {
|
||||
// private BettingApiClient _client;
|
||||
// private BetfairHorseRacingQueries _horseRacingApi;
|
||||
|
||||
// public AutoBetBot()
|
||||
// {
|
||||
// var auth = new Authentication("TheRocker1987", "reSharper1036!", "H5TT4zKqOlRCpNOr");
|
||||
// _client = new BettingApiClient(auth);
|
||||
// _horseRacingApi = new BetfairHorseRacingQueries(_client);
|
||||
// }
|
||||
|
||||
// public async Task MakeBets()
|
||||
// {
|
||||
// var catalogues = await _horseRacingApi.GetHorseWinCatalogue(DateTime.UtcNow.AddHours(1), DateTime.UtcNow.AddDays(1));
|
||||
// var catalogueIdToCatalogue = catalogues.ToDictionary(e => e.MarketId, e => e);
|
||||
|
||||
// var horseIdToHorseName = catalogues.SelectMany(e1 => e1.Runners)
|
||||
// .ToDictionary(e => e.SelectionId, e => e.RunnerName);
|
||||
|
||||
// using (var mainDb = new ExpandoObject())
|
||||
// {
|
||||
|
||||
// var account = await mainDb.Accounts.LastOrDefaultAsync();
|
||||
// var latestTransaction = await mainDb.Transactions.Where(e => e.AccountId == account.Id).LastOrDefaultAsync();
|
||||
// await CheckBetOutComes(mainDb, account, latestTransaction);
|
||||
// latestTransaction = await mainDb.Transactions.Where(e => e.AccountId == account.Id).LastOrDefaultAsync();
|
||||
// var marketIdsAlreadyBet = await mainDb.Bets.Where(e => e.Transaction.AccountId == account.Id)
|
||||
// .Select(e => e.ExchangeMarketId)
|
||||
// .ToArrayAsync();
|
||||
// var remainingLiability = latestTransaction.ElidgableLiability;
|
||||
|
||||
// var marketBooks = await _horseRacingApi.GetMarketBookPrices(catalogues);
|
||||
// marketBooks = marketBooks.Where(e => !marketIdsAlreadyBet.Contains(e.MarketId)).ToArray();
|
||||
// foreach (var item in marketBooks)
|
||||
// {
|
||||
// // var liabilityUsed = await BetOnBook(item, stake, remainingLiability, catalogueIdToCatalogue, horseIdToHorseName, mainDb, account, latestTransaction);
|
||||
// //remainingLiability -= liabilityUsed;
|
||||
// }
|
||||
// }
|
||||
|
||||
// Console.WriteLine("Finished");
|
||||
// }
|
||||
|
||||
// private async Task CheckBetOutComes(MainDb mainDb, Account account, AccountTransaction transaction)
|
||||
// {
|
||||
// var unselltedBets = mainDb.Bets.Where(e => e.Status == Database.Models.BetStatus.Unsettled).ToDictionary(e => e.ExchangeBetId, e => e);
|
||||
// var settledBets = await _client.ListClearedOrders(SuccessfulCode.BetfairApi.BettingModels.Enums.BetStatus.Settled, betIds: unselltedBets.Keys.ToArray());
|
||||
// foreach(var bet in settledBets.ClearedOrders)
|
||||
// {
|
||||
// if (!unselltedBets.TryGetValue(bet.BetId, out Bet betRecord))
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// betRecord.Status = bet.Profit > 0 ? Database.Models.BetStatus.Won : Database.Models.BetStatus.Lost;
|
||||
// if(betRecord.Status == Database.Models.BetStatus.Won)
|
||||
// {
|
||||
// var reserverFunds = 1;//Math.Round(bet.Profit.PercentOf(20.00m) - 0.005m, 2);
|
||||
// var recordTransaction = new AccountTransaction()
|
||||
// {
|
||||
// AccountId = account.Id,
|
||||
// CreatedAt = DateTime.UtcNow,
|
||||
// ElidgableLiability = transaction.ElidgableLiability + betRecord.Liability + (bet.Profit - reserverFunds),
|
||||
// TransactionType = TransactionType.BetPlaced,
|
||||
// ReservedFunds = transaction.ReservedFunds += reserverFunds
|
||||
// };
|
||||
// mainDb.Transactions.Add(recordTransaction);
|
||||
// }
|
||||
// }
|
||||
// await mainDb.SaveChangesAsync();
|
||||
// }
|
||||
|
||||
// private async Task<decimal> BetOnBook(
|
||||
// MarketBook book,
|
||||
// decimal stake,
|
||||
// decimal remainingLiability,
|
||||
// Dictionary<string, MarketCatalogue> catalogueIdToCatalog,
|
||||
// Dictionary<long, string> horseIdToName,
|
||||
// MainDb db,
|
||||
// Account account,
|
||||
// AccountTransaction transaction
|
||||
// )
|
||||
// {
|
||||
// var eventDetails = catalogueIdToCatalog[book.MarketId];
|
||||
// var runners = book.Runners.Where(e => e.ExchangePrices.AvailableToLay.Length > 0)
|
||||
// .OrderBy(e => e.ExchangePrices.AvailableToLay[0].Price)
|
||||
// .ToArray();
|
||||
|
||||
// Console.WriteLine($"{eventDetails.Event.Name} @ {eventDetails.MarketStartTime}");
|
||||
// foreach (var runner in runners)
|
||||
// {
|
||||
// Console.WriteLine($"-{horseIdToName[runner.SelectionId]}:{runner.ExchangePrices.AvailableToLay[0].Price} Liability: {(runner.ExchangePrices.AvailableToLay[0].Price * stake) - stake}");
|
||||
// }
|
||||
|
||||
// if (runners.Length <= 3)
|
||||
// {
|
||||
// Console.WriteLine($"Less than 3 horses to lay against");
|
||||
// return 0m;
|
||||
// }
|
||||
|
||||
// var selectedRunner = runners.Skip(3)
|
||||
// .Where(e => e.ExchangePrices.AvailableToLay[0].Price > 7 && e.ExchangePrices.AvailableToLay[0].Price < 10.001m)
|
||||
// .FirstOrDefault();
|
||||
|
||||
// if (selectedRunner == null)
|
||||
// {
|
||||
// Console.WriteLine("No elidgable runner");
|
||||
// return 0m;
|
||||
// }
|
||||
|
||||
// var liability = (selectedRunner.ExchangePrices.AvailableToLay[0].Price * stake) - stake;
|
||||
// Console.WriteLine($"Selected:{horseIdToName[selectedRunner.SelectionId]}:{selectedRunner.ExchangePrices.AvailableToLay[0].Price} Liability: {liability}");
|
||||
|
||||
// if (liability > remainingLiability)
|
||||
// {
|
||||
// Console.WriteLine($"Passing horse as {liability} need but only {transaction.ElidgableLiability} available");
|
||||
// return 0m;
|
||||
// }
|
||||
// //var placeBetResult = new PlaceExecutionReport()
|
||||
// //{
|
||||
// // InstructionReports = new[]
|
||||
// // {
|
||||
// // new PlaceInstructionReport()
|
||||
// // {
|
||||
// // BetId = "Not real"
|
||||
// // }
|
||||
// // }
|
||||
// //};
|
||||
// var placeBetResult = await _client.PlaceOrders(eventDetails.MarketId, new PlaceInstruction[] {
|
||||
// new PlaceInstruction()
|
||||
// {
|
||||
// SelectionId = selectedRunner.SelectionId,
|
||||
// Side = Side.Lay,
|
||||
// OrderType = OrderType.Limit,
|
||||
// LimitOrder = new LimitOrder
|
||||
// {
|
||||
// Price = selectedRunner.ExchangePrices.AvailableToLay[0].Price,
|
||||
// Size = stake,
|
||||
// PersistenceType = PersistenceType.Lapse
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
// if (placeBetResult.InstructionReports.Length == 0 || String.IsNullOrWhiteSpace(placeBetResult.InstructionReports[0].BetId))
|
||||
// {
|
||||
// Console.WriteLine("Bet failed at exchange");
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
// remainingLiability -= liability;
|
||||
|
||||
// var betRecord = CreateBetRecord(stake, horseIdToName, eventDetails, selectedRunner, liability, placeBetResult);
|
||||
// var tranasctionRecord = CreateTransactionRecord(remainingLiability, account, transaction, betRecord);
|
||||
// await SaveTranasction(db, tranasctionRecord);
|
||||
|
||||
// Console.WriteLine("--bet placed");
|
||||
// return remainingLiability;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BritishHorseRacingApi" Version="1.0.43" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="SuccessfulCode.BetfairApi" Version="1.0.11" />
|
||||
<PackageReference Include="SuccessfulCodeTools" Version="1.0.8" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AutoBet.Db\AutoBet.Db.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="SwiftyMessageHub.Core">
|
||||
<HintPath>..\..\SwiftyMessageHub\SwiftyMessageHub.RabbitMq\bin\Debug\netstandard2.0\SwiftyMessageHub.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SwiftyMessageHub.RabbitMq">
|
||||
<HintPath>..\..\SwiftyMessageHub\SwiftyMessageHub.RabbitMq\bin\Debug\netstandard2.0\SwiftyMessageHub.RabbitMq.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<targets>
|
||||
<target name="logfile" xsi:type="File" fileName="file.txt" />
|
||||
<target name="logconsole" xsi:type="Console" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<logger name="*" minlevel="Info" writeTo="logconsole" />
|
||||
<logger name="*" minlevel="Debug" writeTo="logfile" />
|
||||
</rules>
|
||||
</nlog>
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
using AutoBet.DataRecorded.RaceResultsDataCollector;
|
||||
using BritishHorseRacingApi;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SwiftyMessageHub.Core;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AutoBet.DataRecorded.MessageControllers
|
||||
{
|
||||
public class PostRaceDataCollectorController : MessageController
|
||||
{
|
||||
[MessageRoute]
|
||||
public async Task LoadRaces(PostRaceDataCollectorDetails details)
|
||||
{
|
||||
var api = new ApiClient();
|
||||
Console.WriteLine("Loading races");
|
||||
using (var db = new Db.HorseRacingDataContext())
|
||||
{
|
||||
var results = await db.Races.Where(e => e.RaceDate.Date == details.DateToCollect.Date)
|
||||
.Where(e => !db.RunnerResults.Any(e1 => e1.RaceId == e.RaceId))
|
||||
.ToListAsync();
|
||||
|
||||
foreach (var result in results)
|
||||
{
|
||||
await CurrentContext.Hub.SendMessage(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
using BritishHorseRacingApi;
|
||||
using BritishHorseRacingApi.Models;
|
||||
using SwiftyMessageHub.Core;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AutoBet.DataRecorded.MessageControllers
|
||||
{
|
||||
public class PostRaceRunnerCollectorController : MessageController
|
||||
{
|
||||
private static SemaphoreSlim _semaphore = new SemaphoreSlim(1);
|
||||
[MessageRoute]
|
||||
public async Task LoadRaces(Db.Race details)
|
||||
{
|
||||
var api = new ApiClient();
|
||||
Console.WriteLine($"Getting results for race {details.RaceId}");
|
||||
_semaphore.Wait();
|
||||
PagedResult<RunnerResult> results;
|
||||
try
|
||||
{
|
||||
results = await api.GetRaceResults(details.RaceDate.Year, details.RaceId, details.DivisionSequence);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_semaphore.Release();
|
||||
}
|
||||
foreach (var result in results.Data)
|
||||
{
|
||||
await CurrentContext.Hub.SendMessage(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
using BritishHorseRacingApi.Models;
|
||||
using SwiftyMessageHub.Core;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AutoBet.DataRecorded.MessageControllers
|
||||
{
|
||||
public class PostRaceRunnerResultRecorderController : MessageController
|
||||
{
|
||||
[MessageRoute]
|
||||
public async Task SaveRunnerResult(RunnerResult details)
|
||||
{
|
||||
Console.WriteLine($"Saving results for {details.RacehorseName}");
|
||||
var dbRunnerResult = new Db.RunnerResult()
|
||||
{
|
||||
RaceId = details.RaceId,
|
||||
YearOfRace = details.YearOfRace,
|
||||
DivisionSequence = details.DivisionSequence,
|
||||
HorseId = details.HorseId,
|
||||
AnimalId = details.AnimalId,
|
||||
ResultFinishPos = details.ResultFinishPos,
|
||||
Status = details.Status,
|
||||
Ran = details.Ran,
|
||||
NonRunnerDeclaredReason = details.NonRunnerDeclaredReason,
|
||||
NonRunnerDeclaredDate = details.NonRunnerDeclaredDate,
|
||||
NonRunnerDeclaredTime = details.NonRunnerDeclaredTime,
|
||||
RacehorseName = details.RacehorseName,
|
||||
AgeYear = details.AgeYear,
|
||||
Bred = details.Bred,
|
||||
ClothNumber = details.ClothNumber,
|
||||
DrawnStall = details.DrawnStall,
|
||||
WeightValue = details.WeightValue,
|
||||
SexType = details.SexType,
|
||||
JockeyId = details.JockeyId,
|
||||
JockeyName = details.JockeyName,
|
||||
JockeyProfile = details.JockeyProfile,
|
||||
TrainerId = details.TrainerId,
|
||||
TrainerName = details.TrainerName,
|
||||
OwnerId = details.OwnerId,
|
||||
OwnerName = details.OwnerName,
|
||||
WbSilkCode = details.WbSilkCode,
|
||||
WbSilkDescription = details.WbSilkDescription,
|
||||
SilkImage = details.SilkImage,
|
||||
Plus10 = details.Plus10,
|
||||
ResultBtnDistance = details.ResultBtnDistance,
|
||||
PositionFinishTime = details.PositionFinishTime,
|
||||
BettingRatio = details.BettingRatio,
|
||||
PerformanceFigure = details.PerformanceFigure,
|
||||
RatingFlat = details.RatingFlat,
|
||||
RatingAwt = details.RatingAwt,
|
||||
RatingChase = details.RatingChase,
|
||||
RatingHurdle = details.RatingHurdle,
|
||||
RaceCriteriaRaceType = details.RaceCriteriaRaceType,
|
||||
Hro = details.Hro,
|
||||
FinishTime = details.FinishTime,
|
||||
ResultFinishDNF = details.ResultFinishDNF,
|
||||
FinishTimeInMilliseconds = String.IsNullOrWhiteSpace(details.ResultFinishDNF) ? details.FinishTimeInMilliseconds() : null,
|
||||
LossMilliseconds = details.LossMilliseconds(),
|
||||
};
|
||||
using(var db = new Db.HorseRacingDataContext())
|
||||
{
|
||||
db.RunnerResults.Add(dbRunnerResult);
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
Console.WriteLine($"Saved results for {details.RacehorseName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace AutoBet.DataRecorded.RaceResultsDataCollector
|
||||
{
|
||||
public class PostRaceDataCollectorDetails
|
||||
{
|
||||
public DateTime DateToCollect { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using SuccessfulCode.BetfairApi;
|
||||
using SuccessfulCode.BetfairApi.BettingModels;
|
||||
using SwiftyMessageHub.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AutoBet.DataRecorded.MessageControllers
|
||||
{
|
||||
public class OddsDataCollectorController : MessageController
|
||||
{
|
||||
[MessageRoute]
|
||||
public async Task GenerateSnapshot(OddsSnapshotDetails details)
|
||||
{
|
||||
var auth = new Authentication("TheRocker1987", "reSharper1036!", "H5TT4zKqOlRCpNOr");
|
||||
var client = new BettingApiClient(auth);
|
||||
var horseRacingQueries = new BetfairHorseRacingQueries(client);
|
||||
var horseWins = await horseRacingQueries.GetHorseWinCatalogue(DateTime.UtcNow.AddHours(-2), DateTime.UtcNow);
|
||||
var marketDetails = horseWins.ToDictionary(e => e.MarketId, e => e);
|
||||
var horseDetails = horseWins.SelectMany(e => e.Runners.Select(e1 => new { Key = (e.MarketId, e1.SelectionId), Value = e1 })).ToDictionary(e => e.Key, e => e.Value);
|
||||
var prices = await horseRacingQueries.GetBestPrices(horseWins.Select(e => e.MarketId).ToArray());
|
||||
var snapShots = prices.SelectMany(e => e.Runners.Select(e1 => GenerateOddsSnapshots(marketDetails, horseDetails, e1, e)));
|
||||
|
||||
foreach (var snapshot in snapShots)
|
||||
{
|
||||
await SendResponse(snapshot);
|
||||
}
|
||||
}
|
||||
|
||||
private static Db.OddsSnapshot GenerateOddsSnapshots(Dictionary<string, MarketCatalogue> marketDetails, Dictionary<(string MarketId, long SelectionId), RunnerCatalog> horseDetails, Runner runner, MarketBook book)
|
||||
{
|
||||
var marketDetail = marketDetails[book.MarketId];
|
||||
var horseDetail = horseDetails[(marketDetail.MarketId, runner.SelectionId)];
|
||||
var runnerName = Regex.Match(horseDetail.RunnerName, "^[0-9]*\\.? ?(.*)", RegexOptions.Compiled).Groups[1].Value;
|
||||
var oddsSnapshot = new Db.OddsSnapshot()
|
||||
{
|
||||
EventName = marketDetail.Event.Name,
|
||||
HorseName = runnerName,
|
||||
JockeyName = horseDetail.Metadata.JockeyName,
|
||||
Odds = GenerateOdds(runner),
|
||||
SnapshotDate = DateTime.UtcNow
|
||||
};
|
||||
|
||||
return oddsSnapshot;
|
||||
}
|
||||
|
||||
private static List<Db.BetOdds> GenerateOdds(Runner e1)
|
||||
{
|
||||
var backOdds = e1.ExchangePrices.AvailableToBack.Select(e => new Db.BetOdds()
|
||||
{
|
||||
OddsType = Db.OddsType.Back,
|
||||
Available = (decimal)e.Size,
|
||||
Odds = e.Price
|
||||
}).ToList();
|
||||
|
||||
var layOdds = e1.ExchangePrices.AvailableToBack.Select(e => new Db.BetOdds()
|
||||
{
|
||||
OddsType = Db.OddsType.Lay,
|
||||
Available = (decimal)e.Size,
|
||||
Odds = e.Price
|
||||
}).ToList();
|
||||
|
||||
backOdds.AddRange(layOdds);
|
||||
return backOdds;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using SwiftyMessageHub.Core;
|
||||
|
||||
namespace AutoBet.DataRecorded.MessageControllers
|
||||
{
|
||||
[MessageType("OddsSnapshotDetails")]
|
||||
public class OddsSnapshotDetails
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using AutoBet.Db;
|
||||
using SwiftyMessageHub.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AutoBet.DataRecorded.MessageControllers
|
||||
{
|
||||
public class OddsDataRecorderController : MessageController
|
||||
{
|
||||
[MessageRoute]
|
||||
public async Task SaveSnapshot(OddsSnapshot snapshotToSave)
|
||||
{
|
||||
using (var db = new HorseRacingDataContext())
|
||||
{
|
||||
db.OddsSnapshots.Add(snapshotToSave);
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
using SwiftyMessageHub.Core;
|
||||
using System;
|
||||
|
||||
namespace AutoBet.DataRecorded
|
||||
{
|
||||
[MessageType("PreRaceDataSnapshotDetails")]
|
||||
public class PreRaceDataCollectDetails
|
||||
{
|
||||
public DateTime DateToCollect { get; set; }
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
using SwiftyMessageHub.Core;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AutoBet.DataRecorded.MessageControllers
|
||||
{
|
||||
public class PreRaceDataCollectorController : MessageController
|
||||
{
|
||||
[MessageRoute]
|
||||
public async Task CollectPreRaceData(PreRaceDataCollectDetails details)
|
||||
{
|
||||
var client = new BritishHorseRacingApi.ApiClient();
|
||||
var date = details.DateToCollect;
|
||||
Console.WriteLine("Loading races");
|
||||
var races = await client.GetAllRacesForDay(date.Year, date.Month, date.Day);
|
||||
foreach (var race in races)
|
||||
{
|
||||
Console.WriteLine($"Race id {race.RaceId} loaded");
|
||||
await CurrentContext.Hub.SendMessage(race);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
using BritishHorseRacingApi.Models;
|
||||
using AutoBet.DataRecorded.PreRaceRunnerCollector;
|
||||
using SwiftyMessageHub.Core;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
|
||||
namespace AutoBet.DataRecorded.PreRaceDataRecorder
|
||||
{
|
||||
public class PreRaceDataRecorderController : MessageController
|
||||
{
|
||||
[MessageRoute]
|
||||
public async Task CollectPreRaceData(Race details)
|
||||
{
|
||||
Console.WriteLine($"Saving race id {details.RaceId}");
|
||||
using (var db = new Db.HorseRacingDataContext())
|
||||
{
|
||||
db.Races.Add(new Db.Race()
|
||||
{
|
||||
DistanceChangeText = details.DistanceChangeText,
|
||||
BlackTypeRace = details.BlackTypeRace,
|
||||
AbandonedReasonCode = details.AbandonedReasonCode,
|
||||
RaceCriteriaRaceType = details.RaceCriteriaRaceType,
|
||||
DistanceChange = details.DistanceChange,
|
||||
DistanceText = details.DistanceText,
|
||||
DistanceValue = details.DistanceValue,
|
||||
DistanceUnits = details.DistanceUnits,
|
||||
RawDistanceText = details.RawDistanceText,
|
||||
RatingBand = details.RatingBand,
|
||||
RaceClass = details.RaceClass,
|
||||
PrizeCurrency = details.PrizeCurrency,
|
||||
PrizeAmount = details.PrizeAmount,
|
||||
AgeLimit = details.AgeLimit,
|
||||
RaceName = details.RaceName,
|
||||
RaceTime = details.RaceTime,
|
||||
RaceDate = details.RaceDate,
|
||||
DivisionSequence = details.DivisionSequence,
|
||||
YearOfRace = details.YearOfRace,
|
||||
RaceId = details.RaceId,
|
||||
Plus10 = details.Plus10,
|
||||
});
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
await CurrentContext.Hub.SendMessage(new PreRaceRunnerCollectDetails()
|
||||
{
|
||||
DateToCollect = details.RaceDate,
|
||||
RaceId = details.RaceId
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
|
||||
namespace AutoBet.DataRecorded.PreRaceRunnerCollector
|
||||
{
|
||||
public class PreRaceRunnerCollectDetails
|
||||
{
|
||||
public PreRaceRunnerCollectDetails()
|
||||
{
|
||||
}
|
||||
|
||||
public DateTime DateToCollect { get; set; }
|
||||
public int RaceId { get; set; }
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
using BritishHorseRacingApi.Models;
|
||||
using SwiftyMessageHub.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AutoBet.DataRecorded.PreRaceRunnerCollector
|
||||
{
|
||||
public class PreRaceRunnerCollectorController : MessageController
|
||||
{
|
||||
public static SemaphoreSlim semaphore = new SemaphoreSlim(1);
|
||||
[MessageRoute]
|
||||
public async Task CollectPreRaceData(PreRaceRunnerCollectDetails details)
|
||||
{
|
||||
var client = new BritishHorseRacingApi.ApiClient();
|
||||
var date = details.DateToCollect;
|
||||
Console.WriteLine($"Preparing to load runners for race id {details.RaceId}");
|
||||
await semaphore.WaitAsync();
|
||||
try
|
||||
{
|
||||
Console.WriteLine($"Loading runners for race id {details.RaceId}");
|
||||
var runners = await client.GetRaceRunners(date.Year, details.RaceId);
|
||||
foreach (var runner in runners.Data)
|
||||
{
|
||||
Console.WriteLine($"Loaded runner {runner.RacehorseName} id {details.RaceId}");
|
||||
await CurrentContext.Hub.SendMessage(runner);
|
||||
}
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
semaphore.Release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
using BritishHorseRacingApi.Models;
|
||||
using SwiftyMessageHub.Core;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AutoBet.DataRecorded.PreRaceRunnerRecorder
|
||||
{
|
||||
public class PreRaceRunnerRecorderController : MessageController
|
||||
{
|
||||
[MessageRoute]
|
||||
public async Task RecordRunner(Runner details)
|
||||
{
|
||||
Console.WriteLine($"Saving runner {details.RacehorseName}");
|
||||
using (var db = new Db.HorseRacingDataContext())
|
||||
{
|
||||
db.Runners.Add(new Db.Runner()
|
||||
{
|
||||
HeadGearWearingCode = details.HeadGearWearingCode,
|
||||
HeadGearWearingSheepSkin = details.HeadGearWearingSheepSkin,
|
||||
HeadGearDescription = details.HeadGearDescription,
|
||||
HeadGearAbbreviation = details.HeadGearAbbreviation,
|
||||
JockeyProfile = details.JockeyProfile,
|
||||
CourseWinner = details.CourseWinner,
|
||||
DistanceWinner = details.DistanceWinner,
|
||||
WindSurgeryFirstRun = details.WindSurgeryFirstRun,
|
||||
TrainerId = details.TrainerId,
|
||||
TrainerName = details.TrainerName,
|
||||
OwnerId = details.OwnerId,
|
||||
OwnerName = details.OwnerName,
|
||||
WbSilkCode = details.WbSilkCode,
|
||||
WbSilkDescription = details.WbSilkDescription,
|
||||
SilkImage = details.SilkImage,
|
||||
Plus10 = details.Plus10,
|
||||
ForecastPriceNumerator = details.ForecastPriceNumerator,
|
||||
ForecastPriceDenominator = details.ForecastPriceDenominator,
|
||||
WeightText = details.WeightText,
|
||||
WeightsJockeyClaiming = details.WeightsJockeyClaiming,
|
||||
Odds = details.Odds,
|
||||
DecimalOdds = details.DecimalOdds(),
|
||||
JockeyName = details.JockeyName,
|
||||
Status = (Db.Status)details.Status,
|
||||
RaceId = details.RaceId,
|
||||
YearOfRace = details.YearOfRace,
|
||||
DivisionSequence = details.DivisionSequence,
|
||||
AnimalId = details.AnimalId,
|
||||
RacehorseName = details.RacehorseName,
|
||||
AgeYears = details.AgeYears,
|
||||
Bred = details.Bred,
|
||||
ClothNumber = details.ClothNumber,
|
||||
DrawnStall = details.DrawnStall,
|
||||
ReserveNumber = details.ReserveNumber,
|
||||
BhaRating = details.BhaRating,
|
||||
FormFigures = details.FormFigures,
|
||||
WeightValue = details.WeightValue,
|
||||
PenaltyValue = details.PenaltyValue,
|
||||
SexType = (Db.SexType)details.SexType,
|
||||
NonRunnerDeclaredReason = details.NonRunnerDeclaredReason,
|
||||
NonRunnerDeclaredDate = details.NonRunnerDeclaredDate,
|
||||
NonRunnerDeclaredTime = details.NonRunnerDeclaredTime,
|
||||
RunnerNumber = details.RunnerNumber,
|
||||
JockeyId = details.JockeyId,
|
||||
RaceHorseNameWithoutCountry = details.RacehorseNameWithoutCountry,
|
||||
WeightInGrams = details.WeightInGrams,
|
||||
LastRuns = details.LastRuns?.Select(e => new Db.LastRun()
|
||||
{
|
||||
Days = e.Days,
|
||||
RaceType = e.RaceType
|
||||
}).ToList()
|
||||
});
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,342 @@
|
||||
using AutoBet.DataRecorded.MessageControllers;
|
||||
using SwiftyMessageHub.Core;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using AutoBet.DataRecorded.RaceResultsDataCollector;
|
||||
using BritishHorseRacingApi;
|
||||
using System.Collections.Generic;
|
||||
using BritishHorseRacingApi.Models;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using AutoBet.Db;
|
||||
using ApiModels = BritishHorseRacingApi.Models;
|
||||
|
||||
namespace AutoBet.DataRecorded
|
||||
{
|
||||
class Program
|
||||
{
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
//StartResultsCollection().GetAwaiter().GetResult();
|
||||
//var dayToCollectRunners = GetDayToCollect();
|
||||
await CollectPastResults();
|
||||
|
||||
//await CollectCurrent();
|
||||
//await GetFixtureIds();
|
||||
|
||||
}
|
||||
|
||||
private static async Task GetFixtureIds()
|
||||
{
|
||||
Db.Fixture[] fixturesToProcces;
|
||||
using (var db = new Db.HorseRacingDataContext())
|
||||
{
|
||||
var ids = db.Races.Where(e => e.FixtureId != 0).Select(e => e.FixtureId).ToArray();
|
||||
fixturesToProcces = db.Fixtures.Where(e => !ids.Contains(e.FixtureId)).ToArray();
|
||||
var client = new ApiClient(TimeSpan.FromSeconds(0), "D_SID=188.172.158.138:JT/OEx87nl5ScspTQk38UsDfuIz94DbCf5CYsIC7WpU; __utmz=36595059.1583064856.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); D_ZID=52A68C14-B4B6-3844-8896-9B0E426FEABA; D_ZUID=2E7A90D0-30B7-31B4-BB43-CB2B0DACBDF8; D_HID=0316E576-4AF0-35A5-BEB9-CECB592B4EC2; bha-ie-test=true; __utmc=36595059; __utma=36595059.34208775.1583064856.1583966446.1584046318.17; bha_token=%7B%22token%22%3A%22MjE3Y2I1NDBhYWViZWQ0YmM4YjZmYjg2NDRlOTA2NzU%3D%22%2C%22timestamp%22%3A1584046320723%7D; D_IID=A18DB74E-9ABD-33E1-BF94-96209AF6178E; D_UID=9CDC96FD-4EFE-308E-BC28-2F105AC0B01B; __utmt=1; __utmb=36595059.6.10.1584046318");
|
||||
foreach (var fixture in fixturesToProcces)
|
||||
{
|
||||
var races = await client.GetRaces(fixture.FixtureYear, fixture.FixtureId);
|
||||
foreach (var race in races.Data)
|
||||
{
|
||||
var dbRace = db.Races.FirstOrDefault(e => e.RaceId == race.RaceId);
|
||||
if (dbRace == null)
|
||||
{
|
||||
AddRace(db, fixture.FixtureId, race);
|
||||
await LoadRunners(fixture.FixtureDate.Date, client, db, race);
|
||||
continue;
|
||||
}
|
||||
|
||||
dbRace.FixtureId = fixture.FixtureId;
|
||||
}
|
||||
db.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task CollectPastResults()
|
||||
{
|
||||
var dayToCollectRunners = new DateTime(2019, 11, 23);// GetDayToCollect();
|
||||
|
||||
var client = new ApiClient(TimeSpan.FromSeconds(0), "D_SID=188.172.158.138:JT/OEx87nl5ScspTQk38UsDfuIz94DbCf5CYsIC7WpU; __utmz=36595059.1583064856.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); D_IID=A18DB74E-9ABD-33E1-BF94-96209AF6178E; D_UID=9CDC96FD-4EFE-308E-BC28-2F105AC0B01B; __utmc=36595059; bha-ie-test=true; D_ZID=3F37C446-48FB-3F85-B8D2-66FC90A17473; D_ZUID=27B27203-7708-3F5E-8C01-86A8BF3A21DD; D_HID=BC00CAA4-06EE-39E0-8579-A00DCFA20171; bha_token=%7B%22token%22%3A%22ZjYxM2UwMWEwZmZjNjdhYmM5NzRmMDhmMGVmOTYxNGY%3D%22%2C%22timestamp%22%3A1586699412252%7D; __utma=36595059.34208775.1583064856.1586685187.1586702516.21; __utmt=1; __utmb=36595059.2.10.1586702516");
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
var dayToCollectResults = dayToCollectRunners;
|
||||
await LoadPreRaceData(dayToCollectRunners, client);
|
||||
await LoadResults(dayToCollectResults, client);
|
||||
dayToCollectRunners = dayToCollectRunners.AddDays(-1);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
Console.WriteLine("Enter new cookie:");
|
||||
var cookie = Console.ReadLine();
|
||||
if (!String.IsNullOrWhiteSpace(cookie))
|
||||
client = new ApiClient(TimeSpan.FromSeconds(0), cookie);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task CollectCurrent()
|
||||
{
|
||||
var dayToCollectRunners = DateTime.Now.Date;
|
||||
var dayToCollectResults = dayToCollectRunners.AddDays(-1);
|
||||
var client = new ApiClient(TimeSpan.FromSeconds(0), "D_SID=188.172.158.138:JT/OEx87nl5ScspTQk38UsDfuIz94DbCf5CYsIC7WpU; __utmz=36595059.1583064856.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); D_ZID=52A68C14-B4B6-3844-8896-9B0E426FEABA; D_ZUID=2E7A90D0-30B7-31B4-BB43-CB2B0DACBDF8; D_HID=0316E576-4AF0-35A5-BEB9-CECB592B4EC2; bha-ie-test=true; __utmc=36595059; D_IID=A18DB74E-9ABD-33E1-BF94-96209AF6178E; D_UID=9CDC96FD-4EFE-308E-BC28-2F105AC0B01B; __utma=36595059.34208775.1583064856.1584046318.1584135333.18; __utmt=1; __utmb=36595059.1.10.1584135333; bha_token=%7B%22token%22%3A%22NTc0OTdjNTRiMjg2ZGYyYzEyYThmMjRlZDZmYmIyMzM%3D%22%2C%22timestamp%22%3A1584135334879%7D");
|
||||
await LoadPreRaceData(dayToCollectRunners, client);
|
||||
await LoadResults(dayToCollectResults, client);
|
||||
}
|
||||
|
||||
private static async Task LoadPreRaceData(DateTime date, ApiClient client)
|
||||
{
|
||||
Console.WriteLine($"Loading fixtures for {date}");
|
||||
var fixtures = await client.GetAllFixturesForDay(date.Year, date.Month, date.Day);
|
||||
using (var db = new Db.HorseRacingDataContext())
|
||||
{
|
||||
foreach (var fixture in fixtures)
|
||||
{
|
||||
Console.WriteLine($"Processing fixture {fixture.FixtureName}");
|
||||
var dbFixture = ApiFixtureToDbFixture(fixture);
|
||||
db.Fixtures.Add(dbFixture);
|
||||
await db.SaveChangesAsync();
|
||||
|
||||
await LoadRaces(date, client, db, fixture.FixtureYear, fixture.FixtureId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task LoadRaces(DateTime date, ApiClient client, HorseRacingDataContext db, int year, int fixtureId)
|
||||
{
|
||||
Console.WriteLine($"Loading races for {date}");
|
||||
var races = await client.GetRaces(year, fixtureId);
|
||||
|
||||
foreach (var race in races.Data)
|
||||
{
|
||||
AddRace(db, fixtureId, race);
|
||||
await db.SaveChangesAsync();
|
||||
await LoadRunners(date, client, db, race);
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task LoadRunners(DateTime date, ApiClient client, HorseRacingDataContext db, ApiModels.Race race)
|
||||
{
|
||||
Console.WriteLine($"Loading runners for race id {race.RaceId}");
|
||||
var runners = await client.GetRaceRunners(date.Year, race.RaceId, race.DivisionSequence);
|
||||
foreach (var runner in runners.Data)
|
||||
{
|
||||
Console.WriteLine($"Loaded runner {runner.RacehorseName} for race {race.RaceId})");
|
||||
db.Runners.Add(new Db.Runner()
|
||||
{
|
||||
HeadGearWearingCode = runner.HeadGearWearingCode,
|
||||
HeadGearWearingSheepSkin = runner.HeadGearWearingSheepSkin,
|
||||
HeadGearDescription = runner.HeadGearDescription,
|
||||
HeadGearAbbreviation = runner.HeadGearAbbreviation,
|
||||
JockeyProfile = runner.JockeyProfile,
|
||||
CourseWinner = runner.CourseWinner,
|
||||
DistanceWinner = runner.DistanceWinner,
|
||||
WindSurgeryFirstRun = runner.WindSurgeryFirstRun,
|
||||
TrainerId = runner.TrainerId,
|
||||
TrainerName = runner.TrainerName,
|
||||
OwnerId = runner.OwnerId,
|
||||
OwnerName = runner.OwnerName,
|
||||
WbSilkCode = runner.WbSilkCode,
|
||||
WbSilkDescription = runner.WbSilkDescription,
|
||||
SilkImage = runner.SilkImage,
|
||||
Plus10 = runner.Plus10,
|
||||
ForecastPriceNumerator = runner.ForecastPriceNumerator,
|
||||
ForecastPriceDenominator = runner.ForecastPriceDenominator,
|
||||
WeightText = runner.WeightText,
|
||||
WeightsJockeyClaiming = runner.WeightsJockeyClaiming,
|
||||
Odds = runner.Odds,
|
||||
DecimalOdds = runner.DecimalOdds(),
|
||||
JockeyName = runner.JockeyName,
|
||||
Status = (Db.Status)runner.Status,
|
||||
RaceId = runner.RaceId,
|
||||
YearOfRace = runner.YearOfRace,
|
||||
DivisionSequence = runner.DivisionSequence,
|
||||
AnimalId = runner.AnimalId,
|
||||
RacehorseName = runner.RacehorseName,
|
||||
AgeYears = runner.AgeYears,
|
||||
Bred = runner.Bred,
|
||||
ClothNumber = runner.ClothNumber,
|
||||
DrawnStall = runner.DrawnStall,
|
||||
ReserveNumber = runner.ReserveNumber,
|
||||
BhaRating = runner.BhaRating,
|
||||
FormFigures = runner.FormFigures,
|
||||
WeightValue = runner.WeightValue,
|
||||
PenaltyValue = runner.PenaltyValue,
|
||||
SexType = (Db.SexType)runner.SexType,
|
||||
NonRunnerDeclaredReason = runner.NonRunnerDeclaredReason,
|
||||
NonRunnerDeclaredDate = runner.NonRunnerDeclaredDate,
|
||||
NonRunnerDeclaredTime = runner.NonRunnerDeclaredTime,
|
||||
RunnerNumber = runner.RunnerNumber,
|
||||
JockeyId = runner.JockeyId,
|
||||
RaceHorseNameWithoutCountry = runner.RacehorseNameWithoutCountry,
|
||||
WeightInGrams = runner.WeightInGrams,
|
||||
LastRuns = runner.LastRuns?.Select(e => new Db.LastRun()
|
||||
{
|
||||
Days = e.Days,
|
||||
RaceType = e.RaceType
|
||||
}).ToList()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddRace(HorseRacingDataContext db, int fixtureId, ApiModels.Race race)
|
||||
{
|
||||
Console.WriteLine($"Saving {race.RaceName}");
|
||||
var dbRace = ApiRaceToDbRace(race, fixtureId);
|
||||
db.Races.Add(dbRace);
|
||||
|
||||
}
|
||||
|
||||
private static Db.Fixture ApiFixtureToDbFixture(ApiModels.Fixture fixture)
|
||||
{
|
||||
return new Db.Fixture()
|
||||
{
|
||||
GoingUpdatedTime = fixture.GoingUpdatedTime,
|
||||
GoingUpdatedDate = fixture.GoingUpdatedDate,
|
||||
FixtureSession = (Db.FixtureSession)fixture.FixtureSession,
|
||||
AbandonedReasonCode = fixture.AbandonedReasonCode,
|
||||
Rail = fixture.Rail,
|
||||
Stalls = fixture.Stalls,
|
||||
Other = fixture.Other,
|
||||
Weather = fixture.Weather,
|
||||
Going = fixture.Going,
|
||||
MajorEvent = fixture.MajorEvent,
|
||||
TicketsLink = fixture.TicketsLink,
|
||||
CourseId = fixture.CourseId,
|
||||
RacePlanningCode = (Db.RacePlanningCode)fixture.RacePlanningCode,
|
||||
RacingTrackType = (Db.RacingTrackType)fixture.RacingTrackType,
|
||||
MeetingId = fixture.MeetingId,
|
||||
FixtureType = (Db.FixtureType)fixture.FixtureType,
|
||||
FixtureName = fixture.FixtureName,
|
||||
NumberOfRaces = fixture.NumberOfRaces,
|
||||
BcsEvent = fixture.BcsEvent,
|
||||
BlackTypeRaces = fixture.BlackTypeRaces,
|
||||
EntriesAvailable = fixture.EntriesAvailable,
|
||||
RacecardAvailable = fixture.RacecardAvailable,
|
||||
ResultsAvailable = fixture.ResultsAvailable,
|
||||
FirstRace = fixture.FirstRace,
|
||||
CourseName = fixture.CourseName,
|
||||
Distance = fixture.Distance,
|
||||
FixtureDate = fixture.FixtureDate,
|
||||
FixtureYear = fixture.FixtureYear,
|
||||
FixtureId = fixture.FixtureId
|
||||
};
|
||||
}
|
||||
|
||||
private static Db.Race ApiRaceToDbRace(ApiModels.Race race, int fixtureId)
|
||||
{
|
||||
return new Db.Race()
|
||||
{
|
||||
DistanceChangeText = race.DistanceChangeText,
|
||||
BlackTypeRace = race.BlackTypeRace,
|
||||
AbandonedReasonCode = race.AbandonedReasonCode,
|
||||
RaceCriteriaRaceType = race.RaceCriteriaRaceType,
|
||||
DistanceChange = race.DistanceChange,
|
||||
DistanceText = race.DistanceText,
|
||||
DistanceValue = race.DistanceValue,
|
||||
DistanceUnits = race.DistanceUnits,
|
||||
RawDistanceText = race.RawDistanceText,
|
||||
RatingBand = race.RatingBand,
|
||||
RaceClass = race.RaceClass,
|
||||
PrizeCurrency = race.PrizeCurrency,
|
||||
PrizeAmount = race.PrizeAmount,
|
||||
AgeLimit = race.AgeLimit,
|
||||
RaceName = race.RaceName,
|
||||
RaceTime = race.RaceTime,
|
||||
RaceDate = race.RaceDate,
|
||||
DivisionSequence = race.DivisionSequence,
|
||||
YearOfRace = race.YearOfRace,
|
||||
RaceId = race.RaceId,
|
||||
Plus10 = race.Plus10,
|
||||
FixtureId = fixtureId
|
||||
};
|
||||
}
|
||||
|
||||
private static async Task LoadResults(DateTime date, ApiClient client)
|
||||
{
|
||||
using (var db = new Db.HorseRacingDataContext())
|
||||
{
|
||||
var races = await db.Races.Where(e => e.RaceDate == date.Date).ToListAsync();
|
||||
foreach(var race in races)
|
||||
{
|
||||
if (race.RaceId != 1684)
|
||||
continue;
|
||||
var results = await client.GetRaceResults(race.YearOfRace, race.RaceId, race.DivisionSequence);
|
||||
foreach (var runnerResult in results.Data)
|
||||
{
|
||||
var dbRunnerResult = new Db.RunnerResult()
|
||||
{
|
||||
RaceId = runnerResult.RaceId,
|
||||
YearOfRace = runnerResult.YearOfRace,
|
||||
DivisionSequence = runnerResult.DivisionSequence,
|
||||
HorseId = runnerResult.HorseId,
|
||||
AnimalId = runnerResult.AnimalId,
|
||||
ResultFinishPos = runnerResult.ResultFinishPos,
|
||||
Status = runnerResult.Status,
|
||||
Ran = runnerResult.Ran,
|
||||
NonRunnerDeclaredReason = runnerResult.NonRunnerDeclaredReason,
|
||||
NonRunnerDeclaredDate = runnerResult.NonRunnerDeclaredDate,
|
||||
NonRunnerDeclaredTime = runnerResult.NonRunnerDeclaredTime,
|
||||
RacehorseName = runnerResult.RacehorseName,
|
||||
RacehorseNameWithoutConuntry = runnerResult.RacehorseNameWithoutCountry,
|
||||
AgeYear = runnerResult.AgeYear,
|
||||
Bred = runnerResult.Bred,
|
||||
ClothNumber = runnerResult.ClothNumber,
|
||||
DrawnStall = runnerResult.DrawnStall,
|
||||
WeightValue = runnerResult.WeightValue,
|
||||
SexType = runnerResult.SexType,
|
||||
JockeyId = runnerResult.JockeyId,
|
||||
JockeyName = runnerResult.JockeyName,
|
||||
JockeyProfile = runnerResult.JockeyProfile,
|
||||
TrainerId = runnerResult.TrainerId,
|
||||
TrainerName = runnerResult.TrainerName,
|
||||
OwnerId = runnerResult.OwnerId,
|
||||
OwnerName = runnerResult.OwnerName,
|
||||
WbSilkCode = runnerResult.WbSilkCode,
|
||||
WbSilkDescription = runnerResult.WbSilkDescription,
|
||||
SilkImage = runnerResult.SilkImage,
|
||||
Plus10 = runnerResult.Plus10,
|
||||
ResultBtnDistance = runnerResult.ResultBtnDistance,
|
||||
PositionFinishTime = runnerResult.PositionFinishTime,
|
||||
BettingRatio = runnerResult.BettingRatio,
|
||||
PerformanceFigure = runnerResult.PerformanceFigure,
|
||||
RatingFlat = runnerResult.RatingFlat,
|
||||
RatingAwt = runnerResult.RatingAwt,
|
||||
RatingChase = runnerResult.RatingChase,
|
||||
RatingHurdle = runnerResult.RatingHurdle,
|
||||
RaceCriteriaRaceType = runnerResult.RaceCriteriaRaceType,
|
||||
Hro = runnerResult.Hro,
|
||||
FinishTime = runnerResult.FinishTime,
|
||||
ResultFinishDNF = runnerResult.ResultFinishDNF,
|
||||
FinishTimeInMilliseconds = String.IsNullOrWhiteSpace(runnerResult.ResultFinishDNF) ? runnerResult.FinishTimeInMilliseconds() : null,
|
||||
LossMilliseconds = runnerResult.LossMilliseconds(),
|
||||
};
|
||||
db.RunnerResults.Add(dbRunnerResult);
|
||||
await db.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static DateTime _dateToCollectRunners = GetDayToCollect();
|
||||
public static DateTime GetDayToCollect()
|
||||
{
|
||||
using(var db = new Db.HorseRacingDataContext())
|
||||
{
|
||||
var date = db.Races.OrderBy(e => e.RaceDate)
|
||||
.Select(e => e.RaceDate)
|
||||
.First()
|
||||
.Date;
|
||||
|
||||
return date.AddDays(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.1.2">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="SuccessfulCodeTools" Version="1.0.8" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public class BetOdds
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public OddsType OddsType { get; set; }
|
||||
public decimal Odds { get; set; }
|
||||
public decimal Available {get;set;}
|
||||
public OddsSnapshot OddsSnapshot { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public class Entity
|
||||
{
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public string Id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public class Fixture : Entity
|
||||
{
|
||||
public string GoingUpdatedTime { get; set; }
|
||||
public string GoingUpdatedDate { get; set; }
|
||||
public FixtureSession FixtureSession { get; set; }
|
||||
public int AbandonedReasonCode { get; set; }
|
||||
public string Rail { get; set; }
|
||||
public string Stalls { get; set; }
|
||||
public string Other { get; set; }
|
||||
public string Weather { get; set; }
|
||||
public string Going { get; set; }
|
||||
public int? MajorEvent { get; set; }
|
||||
public string TicketsLink { get; set; }
|
||||
public int CourseId { get; set; }
|
||||
public RacePlanningCode RacePlanningCode { get; set; }
|
||||
public RacingTrackType RacingTrackType { get; set; }
|
||||
public int MeetingId { get; set; }
|
||||
public FixtureType FixtureType { get; set; }
|
||||
public string FixtureName { get; set; }
|
||||
public int NumberOfRaces { get; set; }
|
||||
public int BcsEvent { get; set; }
|
||||
public int BlackTypeRaces { get; set; }
|
||||
public bool EntriesAvailable { get; set; }
|
||||
public bool RacecardAvailable { get; set; }
|
||||
public bool ResultsAvailable { get; set; }
|
||||
public DateTime? FirstRace { get; set; }
|
||||
public string CourseName { get; set; }
|
||||
public string Distance { get; set; }
|
||||
public DateTime FixtureDate { get; set; }
|
||||
public int FixtureYear { get; set; }
|
||||
public int FixtureId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public enum FixtureSession
|
||||
{
|
||||
Afternoon = 0,
|
||||
Evening = 1,
|
||||
Floodlit = 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public enum FixtureType
|
||||
{
|
||||
Flat = 0,
|
||||
Jump = 1,
|
||||
Mixed = 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public class HorseRacingDataContext : DbContext
|
||||
{
|
||||
public DbSet<Race> Races { get; set; }
|
||||
public DbSet<Runner> Runners { get; set; }
|
||||
public DbSet<LastRun> LastRuns { get; set; }
|
||||
public DbSet<RunnerResult> RunnerResults { get; set; }
|
||||
public DbSet<OddsSnapshot> OddsSnapshots { get; set; }
|
||||
public DbSet<BetOdds> BetOdds { get; set; }
|
||||
public DbSet<Fixture> Fixtures { get; set; }
|
||||
|
||||
public static string ConnectionString { get; } = GenerateConnectionString();
|
||||
private static string GenerateConnectionString()
|
||||
{
|
||||
var connBuilder = new SqlConnectionStringBuilder
|
||||
{
|
||||
IntegratedSecurity = true,
|
||||
InitialCatalog = "AutoBet.DataRecorded2",
|
||||
DataSource = ".\\SQLEXPRESS",
|
||||
ConnectTimeout = (int)TimeSpan.FromMinutes(2).TotalSeconds
|
||||
};
|
||||
return connBuilder.ToString();
|
||||
}
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
|
||||
|
||||
optionsBuilder.UseSqlServer(ConnectionString);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public partial class LastRun
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string RaceType { get; set; }
|
||||
public int Days { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
[Migration("20191229213205_Intialize")]
|
||||
partial class Intialize
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
public partial class Intialize : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "OddsSnapshots",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
EventName = table.Column<string>(nullable: true),
|
||||
HorseName = table.Column<string>(nullable: true),
|
||||
JockeyName = table.Column<string>(nullable: true),
|
||||
SnapshotDate = table.Column<DateTime>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_OddsSnapshots", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "BetOdds",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
OddsType = table.Column<int>(nullable: false),
|
||||
Odds = table.Column<decimal>(nullable: false),
|
||||
Available = table.Column<decimal>(nullable: false),
|
||||
OddsSnapshotId = table.Column<int>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_BetOdds", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_BetOdds_OddsSnapshots_OddsSnapshotId",
|
||||
column: x => x.OddsSnapshotId,
|
||||
principalTable: "OddsSnapshots",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_BetOdds_OddsSnapshotId",
|
||||
table: "BetOdds",
|
||||
column: "OddsSnapshotId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "BetOdds");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "OddsSnapshots");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
[Migration("20200223123134_RaceDetail")]
|
||||
partial class RaceDetail
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RunnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RunnerId");
|
||||
|
||||
b.ToTable("LastRuns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Race", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AgeLimit")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("BlackTypeRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DistanceChange")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceChangeText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceUnits")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DistanceValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Plus10")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PrizeAmount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PrizeCurrency")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceClass")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("RaceDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan>("RaceTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<string>("RatingBand")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RawDistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Races");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Runner", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYears")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BhaRating")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ForecastPriceDenominator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ForecastPriceNumerator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FormFigures")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearAbbreviation")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearWearingCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("HeadGearWearingSheepSkin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Odds")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("PenaltyValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ReserveNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RunnerNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SexType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WeightsJockeyClaiming")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WindSurgeryFirstRun")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Runners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.RunnerResult", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RunnerResults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.Runner", null)
|
||||
.WithMany("LastRuns")
|
||||
.HasForeignKey("RunnerId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
public partial class RaceDetail : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Races",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(nullable: false),
|
||||
DistanceChangeText = table.Column<string>(nullable: true),
|
||||
BlackTypeRace = table.Column<int>(nullable: false),
|
||||
AbandonedReasonCode = table.Column<int>(nullable: false),
|
||||
RaceCriteriaRaceType = table.Column<string>(nullable: true),
|
||||
DistanceChange = table.Column<string>(nullable: true),
|
||||
DistanceText = table.Column<string>(nullable: true),
|
||||
DistanceValue = table.Column<int>(nullable: false),
|
||||
DistanceUnits = table.Column<string>(nullable: true),
|
||||
RawDistanceText = table.Column<string>(nullable: true),
|
||||
RatingBand = table.Column<string>(nullable: true),
|
||||
RaceClass = table.Column<int>(nullable: false),
|
||||
PrizeCurrency = table.Column<string>(nullable: true),
|
||||
PrizeAmount = table.Column<int>(nullable: false),
|
||||
AgeLimit = table.Column<string>(nullable: true),
|
||||
RaceName = table.Column<string>(nullable: true),
|
||||
RaceTime = table.Column<TimeSpan>(nullable: false),
|
||||
RaceDate = table.Column<DateTime>(nullable: false),
|
||||
DivisionSequence = table.Column<int>(nullable: false),
|
||||
YearOfRace = table.Column<int>(nullable: false),
|
||||
RaceId = table.Column<int>(nullable: false),
|
||||
Plus10 = table.Column<bool>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Races", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "RunnerResults",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_RunnerResults", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Runners",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(nullable: false),
|
||||
HeadGearWearingCode = table.Column<string>(nullable: true),
|
||||
HeadGearWearingSheepSkin = table.Column<int>(nullable: false),
|
||||
HeadGearDescription = table.Column<string>(nullable: true),
|
||||
HeadGearAbbreviation = table.Column<string>(nullable: true),
|
||||
JockeyProfile = table.Column<int>(nullable: false),
|
||||
CourseWinner = table.Column<string>(nullable: true),
|
||||
DistanceWinner = table.Column<string>(nullable: true),
|
||||
WindSurgeryFirstRun = table.Column<string>(nullable: true),
|
||||
TrainerId = table.Column<int>(nullable: false),
|
||||
TrainerName = table.Column<string>(nullable: true),
|
||||
OwnerId = table.Column<int>(nullable: false),
|
||||
OwnerName = table.Column<string>(nullable: true),
|
||||
WbSilkCode = table.Column<string>(nullable: true),
|
||||
WbSilkDescription = table.Column<string>(nullable: true),
|
||||
SilkImage = table.Column<string>(nullable: true),
|
||||
Plus10 = table.Column<int>(nullable: false),
|
||||
ForecastPriceNumerator = table.Column<string>(nullable: true),
|
||||
ForecastPriceDenominator = table.Column<string>(nullable: true),
|
||||
WeightText = table.Column<string>(nullable: true),
|
||||
WeightsJockeyClaiming = table.Column<int>(nullable: false),
|
||||
Odds = table.Column<string>(nullable: true),
|
||||
JockeyName = table.Column<string>(nullable: true),
|
||||
Status = table.Column<int>(nullable: false),
|
||||
RaceId = table.Column<int>(nullable: false),
|
||||
YearOfRace = table.Column<int>(nullable: false),
|
||||
DivisionSequence = table.Column<int>(nullable: false),
|
||||
AnimalId = table.Column<int>(nullable: false),
|
||||
RacehorseName = table.Column<string>(nullable: true),
|
||||
AgeYears = table.Column<int>(nullable: false),
|
||||
Bred = table.Column<string>(nullable: true),
|
||||
ClothNumber = table.Column<int>(nullable: false),
|
||||
DrawnStall = table.Column<int>(nullable: true),
|
||||
ReserveNumber = table.Column<string>(nullable: true),
|
||||
BhaRating = table.Column<string>(nullable: true),
|
||||
FormFigures = table.Column<string>(nullable: true),
|
||||
WeightValue = table.Column<string>(nullable: true),
|
||||
PenaltyValue = table.Column<int>(nullable: false),
|
||||
SexType = table.Column<int>(nullable: false),
|
||||
NonRunnerDeclaredReason = table.Column<string>(nullable: true),
|
||||
NonRunnerDeclaredDate = table.Column<string>(nullable: true),
|
||||
NonRunnerDeclaredTime = table.Column<string>(nullable: true),
|
||||
RunnerNumber = table.Column<int>(nullable: false),
|
||||
JockeyId = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Runners", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "LastRuns",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
RaceType = table.Column<string>(nullable: true),
|
||||
Days = table.Column<int>(nullable: false),
|
||||
RunnerId = table.Column<string>(nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_LastRuns", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_LastRuns_Runners_RunnerId",
|
||||
column: x => x.RunnerId,
|
||||
principalTable: "Runners",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LastRuns_RunnerId",
|
||||
table: "LastRuns",
|
||||
column: "RunnerId");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "LastRuns");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Races");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Runners");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,467 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
[Migration("20200227201354_RaceRunnerDetails")]
|
||||
partial class RaceRunnerDetails
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RunnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RunnerId");
|
||||
|
||||
b.ToTable("LastRuns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Race", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AgeLimit")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("BlackTypeRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DistanceChange")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceChangeText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceUnits")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DistanceValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Plus10")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PrizeAmount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PrizeCurrency")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceClass")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("RaceDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan>("RaceTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<string>("RatingBand")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RawDistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Races");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Runner", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYears")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BhaRating")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ForecastPriceDenominator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ForecastPriceNumerator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FormFigures")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearAbbreviation")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearWearingCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("HeadGearWearingSheepSkin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Odds")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("PenaltyValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ReserveNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RunnerNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SexType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WeightsJockeyClaiming")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WindSurgeryFirstRun")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Runners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.RunnerResult", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BettingRatio")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("FinishTimeInMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HorseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Hro")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("LossMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan?>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<int?>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PerformanceFigure")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PositionFinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RacehorseNameWithoutConuntry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Ran")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingAwt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RatingChase")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("RatingFlat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingHurdle")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultBtnDistance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ResultFinishPos")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SexType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WeightValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RunnerResults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.Runner", null)
|
||||
.WithMany("LastRuns")
|
||||
.HasForeignKey("RunnerId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,412 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
public partial class RaceRunnerDetails : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "AgeYear",
|
||||
table: "RunnerResults",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "AnimalId",
|
||||
table: "RunnerResults",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "BettingRatio",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Bred",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ClothNumber",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "DivisionSequence",
|
||||
table: "RunnerResults",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "DrawnStall",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "FinishTime",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "FinishTimeInMilliseconds",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "HorseId",
|
||||
table: "RunnerResults",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Hro",
|
||||
table: "RunnerResults",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "JockeyId",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "JockeyName",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "JockeyProfile",
|
||||
table: "RunnerResults",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "LossMilliseconds",
|
||||
table: "RunnerResults",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "NonRunnerDeclaredDate",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "NonRunnerDeclaredReason",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<TimeSpan>(
|
||||
name: "NonRunnerDeclaredTime",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "OwnerId",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "OwnerName",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "PerformanceFigure",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Plus10",
|
||||
table: "RunnerResults",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "PositionFinishTime",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "RaceCriteriaRaceType",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "RaceId",
|
||||
table: "RunnerResults",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "RacehorseName",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "RacehorseNameWithoutConuntry",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Ran",
|
||||
table: "RunnerResults",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "RatingAwt",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "RatingChase",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "RatingFlat",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "RatingHurdle",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ResultBtnDistance",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ResultFinishPos",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "SexType",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "SilkImage",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Status",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "TrainerId",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "TrainerName",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "WbSilkCode",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "WbSilkDescription",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "WeightValue",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "YearOfRace",
|
||||
table: "RunnerResults",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AgeYear",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "AnimalId",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "BettingRatio",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Bred",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ClothNumber",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DivisionSequence",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DrawnStall",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FinishTime",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FinishTimeInMilliseconds",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HorseId",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Hro",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "JockeyId",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "JockeyName",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "JockeyProfile",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LossMilliseconds",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "NonRunnerDeclaredDate",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "NonRunnerDeclaredReason",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "NonRunnerDeclaredTime",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OwnerId",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "OwnerName",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PerformanceFigure",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Plus10",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "PositionFinishTime",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RaceCriteriaRaceType",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RaceId",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RacehorseName",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RacehorseNameWithoutConuntry",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Ran",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RatingAwt",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RatingChase",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RatingFlat",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RatingHurdle",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ResultBtnDistance",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ResultFinishPos",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SexType",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SilkImage",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Status",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TrainerId",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "TrainerName",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WbSilkCode",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WbSilkDescription",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WeightValue",
|
||||
table: "RunnerResults");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "YearOfRace",
|
||||
table: "RunnerResults");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,467 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
[Migration("20200227234057_RaceRunnerDetailsTime")]
|
||||
partial class RaceRunnerDetailsTime
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RunnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RunnerId");
|
||||
|
||||
b.ToTable("LastRuns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Race", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AgeLimit")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("BlackTypeRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DistanceChange")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceChangeText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceUnits")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DistanceValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Plus10")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PrizeAmount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PrizeCurrency")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceClass")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("RaceDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan>("RaceTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<string>("RatingBand")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RawDistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Races");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Runner", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYears")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BhaRating")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ForecastPriceDenominator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ForecastPriceNumerator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FormFigures")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearAbbreviation")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearWearingCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("HeadGearWearingSheepSkin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Odds")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("PenaltyValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ReserveNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RunnerNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SexType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WeightsJockeyClaiming")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WindSurgeryFirstRun")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Runners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.RunnerResult", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BettingRatio")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("FinishTimeInMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HorseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Hro")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("LossMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan?>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<int?>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PerformanceFigure")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PositionFinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RacehorseNameWithoutConuntry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Ran")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingAwt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RatingChase")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("RatingFlat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingHurdle")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultBtnDistance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ResultFinishPos")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SexType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WeightValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RunnerResults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.Runner", null)
|
||||
.WithMany("LastRuns")
|
||||
.HasForeignKey("RunnerId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
public partial class RaceRunnerDetailsTime : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "LossMilliseconds",
|
||||
table: "RunnerResults",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "LossMilliseconds",
|
||||
table: "RunnerResults",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
+470
@@ -0,0 +1,470 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
[Migration("20200228205907_DNF")]
|
||||
partial class DNF
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RunnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RunnerId");
|
||||
|
||||
b.ToTable("LastRuns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Race", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AgeLimit")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("BlackTypeRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DistanceChange")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceChangeText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceUnits")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DistanceValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Plus10")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PrizeAmount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PrizeCurrency")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceClass")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("RaceDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan>("RaceTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<string>("RatingBand")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RawDistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Races");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Runner", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYears")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BhaRating")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ForecastPriceDenominator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ForecastPriceNumerator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FormFigures")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearAbbreviation")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearWearingCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("HeadGearWearingSheepSkin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Odds")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("PenaltyValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ReserveNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RunnerNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SexType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WeightsJockeyClaiming")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WindSurgeryFirstRun")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Runners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.RunnerResult", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BettingRatio")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("FinishTimeInMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HorseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Hro")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("LossMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan?>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<int?>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PerformanceFigure")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PositionFinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RacehorseNameWithoutConuntry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Ran")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingAwt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RatingChase")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("RatingFlat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingHurdle")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultBtnDistance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultFinishDNF")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ResultFinishPos")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SexType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WeightValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RunnerResults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.Runner", null)
|
||||
.WithMany("LastRuns")
|
||||
.HasForeignKey("RunnerId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
public partial class DNF : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ResultFinishDNF",
|
||||
table: "RunnerResults",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ResultFinishDNF",
|
||||
table: "RunnerResults");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,473 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
[Migration("20200228230741_DecimalOdds")]
|
||||
partial class DecimalOdds
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RunnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RunnerId");
|
||||
|
||||
b.ToTable("LastRuns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Race", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AgeLimit")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("BlackTypeRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DistanceChange")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceChangeText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceUnits")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DistanceValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Plus10")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PrizeAmount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PrizeCurrency")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceClass")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("RaceDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan>("RaceTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<string>("RatingBand")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RawDistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Races");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Runner", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYears")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BhaRating")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("DecimailOdds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("DistanceWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ForecastPriceDenominator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ForecastPriceNumerator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FormFigures")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearAbbreviation")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearWearingCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("HeadGearWearingSheepSkin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Odds")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("PenaltyValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ReserveNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RunnerNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SexType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WeightsJockeyClaiming")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WindSurgeryFirstRun")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Runners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.RunnerResult", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BettingRatio")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("FinishTimeInMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HorseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Hro")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("LossMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan?>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<int?>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PerformanceFigure")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PositionFinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RacehorseNameWithoutConuntry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Ran")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingAwt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RatingChase")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("RatingFlat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingHurdle")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultBtnDistance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultFinishDNF")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ResultFinishPos")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SexType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WeightValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RunnerResults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.Runner", null)
|
||||
.WithMany("LastRuns")
|
||||
.HasForeignKey("RunnerId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
public partial class DecimalOdds : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "DecimailOdds",
|
||||
table: "Runners",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DecimailOdds",
|
||||
table: "Runners");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,473 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
[Migration("20200228231116_DecimalOddsRename")]
|
||||
partial class DecimalOddsRename
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RunnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RunnerId");
|
||||
|
||||
b.ToTable("LastRuns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Race", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AgeLimit")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("BlackTypeRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DistanceChange")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceChangeText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceUnits")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DistanceValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Plus10")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PrizeAmount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PrizeCurrency")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceClass")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("RaceDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan>("RaceTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<string>("RatingBand")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RawDistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Races");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Runner", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYears")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BhaRating")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("DecimalOdds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("DistanceWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ForecastPriceDenominator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ForecastPriceNumerator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FormFigures")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearAbbreviation")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearWearingCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("HeadGearWearingSheepSkin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Odds")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("PenaltyValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ReserveNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RunnerNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SexType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WeightsJockeyClaiming")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WindSurgeryFirstRun")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Runners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.RunnerResult", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BettingRatio")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("FinishTimeInMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HorseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Hro")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("LossMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan?>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<int?>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PerformanceFigure")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PositionFinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RacehorseNameWithoutConuntry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Ran")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingAwt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RatingChase")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("RatingFlat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingHurdle")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultBtnDistance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultFinishDNF")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ResultFinishPos")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SexType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WeightValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RunnerResults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.Runner", null)
|
||||
.WithMany("LastRuns")
|
||||
.HasForeignKey("RunnerId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
public partial class DecimalOddsRename : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DecimailOdds",
|
||||
table: "Runners");
|
||||
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "DecimalOdds",
|
||||
table: "Runners",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "DecimalOdds",
|
||||
table: "Runners");
|
||||
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "DecimailOdds",
|
||||
table: "Runners",
|
||||
type: "decimal(18,2)",
|
||||
nullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,476 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
[Migration("20200228233655_RacehorseNameNoCountry")]
|
||||
partial class RacehorseNameNoCountry
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RunnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RunnerId");
|
||||
|
||||
b.ToTable("LastRuns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Race", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AgeLimit")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("BlackTypeRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DistanceChange")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceChangeText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceUnits")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DistanceValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Plus10")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PrizeAmount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PrizeCurrency")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceClass")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("RaceDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan>("RaceTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<string>("RatingBand")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RawDistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Races");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Runner", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYears")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BhaRating")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("DecimalOdds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("DistanceWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ForecastPriceDenominator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ForecastPriceNumerator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FormFigures")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearAbbreviation")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearWearingCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("HeadGearWearingSheepSkin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Odds")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("PenaltyValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceHorseNameWithoutCountry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ReserveNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RunnerNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SexType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WeightsJockeyClaiming")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WindSurgeryFirstRun")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Runners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.RunnerResult", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BettingRatio")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("FinishTimeInMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HorseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Hro")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("LossMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan?>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<int?>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PerformanceFigure")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PositionFinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RacehorseNameWithoutConuntry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Ran")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingAwt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RatingChase")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("RatingFlat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingHurdle")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultBtnDistance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultFinishDNF")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ResultFinishPos")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SexType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WeightValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RunnerResults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.Runner", null)
|
||||
.WithMany("LastRuns")
|
||||
.HasForeignKey("RunnerId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
public partial class RacehorseNameNoCountry : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "RaceHorseNameWithoutCountry",
|
||||
table: "Runners",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RaceHorseNameWithoutCountry",
|
||||
table: "Runners");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,479 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
[Migration("20200229113517_AddWeightInGrams")]
|
||||
partial class AddWeightInGrams
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RunnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RunnerId");
|
||||
|
||||
b.ToTable("LastRuns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Race", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AgeLimit")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("BlackTypeRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DistanceChange")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceChangeText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceUnits")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DistanceValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Plus10")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PrizeAmount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PrizeCurrency")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceClass")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("RaceDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan>("RaceTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<string>("RatingBand")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RawDistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Races");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Runner", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYears")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BhaRating")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("DecimalOdds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("DistanceWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ForecastPriceDenominator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ForecastPriceNumerator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FormFigures")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearAbbreviation")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearWearingCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("HeadGearWearingSheepSkin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Odds")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("PenaltyValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceHorseNameWithoutCountry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ReserveNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RunnerNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SexType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("WeightInGrams")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("WeightText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WeightsJockeyClaiming")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WindSurgeryFirstRun")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Runners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.RunnerResult", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BettingRatio")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("FinishTimeInMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HorseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Hro")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("LossMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan?>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<int?>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PerformanceFigure")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PositionFinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RacehorseNameWithoutConuntry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Ran")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingAwt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RatingChase")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("RatingFlat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingHurdle")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultBtnDistance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultFinishDNF")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ResultFinishPos")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SexType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WeightValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RunnerResults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.Runner", null)
|
||||
.WithMany("LastRuns")
|
||||
.HasForeignKey("RunnerId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
public partial class AddWeightInGrams : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<decimal>(
|
||||
name: "WeightInGrams",
|
||||
table: "Runners",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "WeightInGrams",
|
||||
table: "Runners");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,482 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
[Migration("20200229185203_AddPredictionToRunner")]
|
||||
partial class AddPredictionToRunner
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RunnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RunnerId");
|
||||
|
||||
b.ToTable("LastRuns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Race", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AgeLimit")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("BlackTypeRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DistanceChange")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceChangeText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceUnits")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DistanceValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Plus10")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PrizeAmount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PrizeCurrency")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceClass")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("RaceDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan>("RaceTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<string>("RatingBand")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RawDistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Races");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Runner", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYears")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BhaRating")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("DecimalOdds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("DistanceWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ForecastPriceDenominator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ForecastPriceNumerator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FormFigures")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearAbbreviation")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearWearingCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("HeadGearWearingSheepSkin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Odds")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("PenaltyValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<float>("Prediction")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<string>("RaceHorseNameWithoutCountry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ReserveNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RunnerNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SexType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("WeightInGrams")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("WeightText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WeightsJockeyClaiming")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WindSurgeryFirstRun")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Runners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.RunnerResult", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BettingRatio")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("FinishTimeInMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HorseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Hro")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("LossMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan?>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<int?>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PerformanceFigure")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PositionFinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RacehorseNameWithoutConuntry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Ran")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingAwt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RatingChase")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("RatingFlat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingHurdle")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultBtnDistance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultFinishDNF")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ResultFinishPos")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SexType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WeightValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RunnerResults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.Runner", null)
|
||||
.WithMany("LastRuns")
|
||||
.HasForeignKey("RunnerId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
public partial class AddPredictionToRunner : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<float>(
|
||||
name: "Prediction",
|
||||
table: "Runners",
|
||||
nullable: false,
|
||||
defaultValue: 0f);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Prediction",
|
||||
table: "Runners");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,580 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
[Migration("20200310165642_AddFixtures")]
|
||||
partial class AddFixtures
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Fixture", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("BcsEvent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("BlackTypeRaces")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CourseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Distance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("EntriesAvailable")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("FirstRace")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("FixtureDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("FixtureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FixtureName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("FixtureSession")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FixtureType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FixtureYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Going")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("GoingUpdatedDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("GoingUpdatedTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("MajorEvent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MeetingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("NumberOfRaces")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Other")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RacePlanningCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("RacecardAvailable")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("RacingTrackType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Rail")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("ResultsAvailable")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Stalls")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("TicketsLink")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Weather")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Fixtures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RunnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RunnerId");
|
||||
|
||||
b.ToTable("LastRuns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Race", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AgeLimit")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("BlackTypeRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DistanceChange")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceChangeText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceUnits")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DistanceValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Plus10")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PrizeAmount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PrizeCurrency")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceClass")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("RaceDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan>("RaceTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<string>("RatingBand")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RawDistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Races");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Runner", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYears")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BhaRating")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("DecimalOdds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("DistanceWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ForecastPriceDenominator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ForecastPriceNumerator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FormFigures")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearAbbreviation")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearWearingCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("HeadGearWearingSheepSkin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Odds")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("PenaltyValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<float>("Prediction")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<string>("RaceHorseNameWithoutCountry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ReserveNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RunnerNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SexType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("WeightInGrams")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("WeightText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WeightsJockeyClaiming")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WindSurgeryFirstRun")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Runners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.RunnerResult", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BettingRatio")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("FinishTimeInMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HorseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Hro")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("LossMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan?>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<int?>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PerformanceFigure")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PositionFinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RacehorseNameWithoutConuntry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Ran")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingAwt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RatingChase")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("RatingFlat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingHurdle")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultBtnDistance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultFinishDNF")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ResultFinishPos")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SexType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WeightValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RunnerResults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.Runner", null)
|
||||
.WithMany("LastRuns")
|
||||
.HasForeignKey("RunnerId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
public partial class AddFixtures : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Fixtures",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(nullable: false),
|
||||
GoingUpdatedTime = table.Column<string>(nullable: true),
|
||||
GoingUpdatedDate = table.Column<string>(nullable: true),
|
||||
FixtureSession = table.Column<int>(nullable: false),
|
||||
AbandonedReasonCode = table.Column<int>(nullable: false),
|
||||
Rail = table.Column<string>(nullable: true),
|
||||
Stalls = table.Column<string>(nullable: true),
|
||||
Other = table.Column<string>(nullable: true),
|
||||
Weather = table.Column<string>(nullable: true),
|
||||
Going = table.Column<string>(nullable: true),
|
||||
MajorEvent = table.Column<int>(nullable: true),
|
||||
TicketsLink = table.Column<string>(nullable: true),
|
||||
CourseId = table.Column<int>(nullable: false),
|
||||
RacePlanningCode = table.Column<int>(nullable: false),
|
||||
RacingTrackType = table.Column<int>(nullable: false),
|
||||
MeetingId = table.Column<int>(nullable: false),
|
||||
FixtureType = table.Column<int>(nullable: false),
|
||||
FixtureName = table.Column<string>(nullable: true),
|
||||
NumberOfRaces = table.Column<int>(nullable: false),
|
||||
BcsEvent = table.Column<int>(nullable: false),
|
||||
BlackTypeRaces = table.Column<int>(nullable: false),
|
||||
EntriesAvailable = table.Column<bool>(nullable: false),
|
||||
RacecardAvailable = table.Column<bool>(nullable: false),
|
||||
ResultsAvailable = table.Column<bool>(nullable: false),
|
||||
FirstRace = table.Column<DateTime>(nullable: true),
|
||||
CourseName = table.Column<string>(nullable: true),
|
||||
Distance = table.Column<string>(nullable: true),
|
||||
FixtureDate = table.Column<DateTime>(nullable: false),
|
||||
FixtureYear = table.Column<int>(nullable: false),
|
||||
FixtureId = table.Column<int>(nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Fixtures", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Fixtures");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,583 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
[Migration("20200311215708_AddFixtureIdToRace")]
|
||||
partial class AddFixtureIdToRace
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Fixture", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("BcsEvent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("BlackTypeRaces")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CourseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Distance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("EntriesAvailable")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("FirstRace")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("FixtureDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("FixtureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FixtureName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("FixtureSession")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FixtureType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FixtureYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Going")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("GoingUpdatedDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("GoingUpdatedTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("MajorEvent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MeetingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("NumberOfRaces")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Other")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RacePlanningCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("RacecardAvailable")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("RacingTrackType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Rail")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("ResultsAvailable")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Stalls")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("TicketsLink")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Weather")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Fixtures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RunnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RunnerId");
|
||||
|
||||
b.ToTable("LastRuns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Race", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AgeLimit")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("BlackTypeRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DistanceChange")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceChangeText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceUnits")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DistanceValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FixtureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Plus10")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PrizeAmount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PrizeCurrency")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceClass")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("RaceDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan>("RaceTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<string>("RatingBand")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RawDistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Races");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Runner", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYears")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BhaRating")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("DecimalOdds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("DistanceWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ForecastPriceDenominator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ForecastPriceNumerator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FormFigures")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearAbbreviation")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearWearingCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("HeadGearWearingSheepSkin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Odds")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("PenaltyValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<float>("Prediction")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<string>("RaceHorseNameWithoutCountry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ReserveNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RunnerNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SexType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("WeightInGrams")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("WeightText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WeightsJockeyClaiming")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WindSurgeryFirstRun")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Runners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.RunnerResult", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BettingRatio")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("FinishTimeInMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HorseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Hro")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("LossMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan?>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<int?>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PerformanceFigure")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PositionFinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RacehorseNameWithoutConuntry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Ran")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingAwt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RatingChase")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("RatingFlat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingHurdle")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultBtnDistance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultFinishDNF")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ResultFinishPos")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SexType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WeightValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RunnerResults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.Runner", null)
|
||||
.WithMany("LastRuns")
|
||||
.HasForeignKey("RunnerId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
public partial class AddFixtureIdToRace : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "FixtureId",
|
||||
table: "Races",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "FixtureId",
|
||||
table: "Races");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,583 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
[Migration("20200413114806_JockeyIdCanBeNull")]
|
||||
partial class JockeyIdCanBeNull
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Fixture", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("BcsEvent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("BlackTypeRaces")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CourseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Distance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("EntriesAvailable")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("FirstRace")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("FixtureDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("FixtureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FixtureName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("FixtureSession")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FixtureType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FixtureYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Going")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("GoingUpdatedDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("GoingUpdatedTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("MajorEvent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MeetingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("NumberOfRaces")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Other")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RacePlanningCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("RacecardAvailable")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("RacingTrackType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Rail")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("ResultsAvailable")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Stalls")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("TicketsLink")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Weather")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Fixtures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RunnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RunnerId");
|
||||
|
||||
b.ToTable("LastRuns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Race", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AgeLimit")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("BlackTypeRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DistanceChange")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceChangeText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceUnits")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DistanceValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FixtureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Plus10")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PrizeAmount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PrizeCurrency")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceClass")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("RaceDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan>("RaceTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<string>("RatingBand")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RawDistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Races");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Runner", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYears")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BhaRating")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("DecimalOdds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("DistanceWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ForecastPriceDenominator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ForecastPriceNumerator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FormFigures")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearAbbreviation")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearWearingCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("HeadGearWearingSheepSkin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Odds")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("PenaltyValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<float>("Prediction")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<string>("RaceHorseNameWithoutCountry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ReserveNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RunnerNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SexType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("WeightInGrams")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("WeightText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WeightsJockeyClaiming")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WindSurgeryFirstRun")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Runners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.RunnerResult", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BettingRatio")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("FinishTimeInMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HorseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Hro")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("LossMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan?>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<int?>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PerformanceFigure")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PositionFinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RacehorseNameWithoutConuntry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Ran")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingAwt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RatingChase")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("RatingFlat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingHurdle")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultBtnDistance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultFinishDNF")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ResultFinishPos")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SexType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WeightValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RunnerResults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.Runner", null)
|
||||
.WithMany("LastRuns")
|
||||
.HasForeignKey("RunnerId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
public partial class JockeyIdCanBeNull : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "JockeyId",
|
||||
table: "Runners",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "JockeyId",
|
||||
table: "Runners",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldNullable: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,581 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AutoBet.Db;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace AutoBet.Db.Migrations
|
||||
{
|
||||
[DbContext(typeof(HorseRacingDataContext))]
|
||||
partial class HorseRacingDataContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.2")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("Available")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<decimal>("Odds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<int?>("OddsSnapshotId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("OddsType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OddsSnapshotId");
|
||||
|
||||
b.ToTable("BetOdds");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Fixture", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("BcsEvent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("BlackTypeRaces")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("CourseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Distance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("EntriesAvailable")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<DateTime?>("FirstRace")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("FixtureDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("FixtureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FixtureName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("FixtureSession")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FixtureType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FixtureYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Going")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("GoingUpdatedDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("GoingUpdatedTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("MajorEvent")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("MeetingId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("NumberOfRaces")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Other")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RacePlanningCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("RacecardAvailable")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("RacingTrackType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Rail")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("ResultsAvailable")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Stalls")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("TicketsLink")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Weather")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Fixtures");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("Days")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RunnerId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RunnerId");
|
||||
|
||||
b.ToTable("LastRuns");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.OddsSnapshot", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("EventName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("SnapshotDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("OddsSnapshots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Race", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AbandonedReasonCode")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("AgeLimit")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("BlackTypeRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("DistanceChange")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceChangeText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("DistanceUnits")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DistanceValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("FixtureId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool>("Plus10")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("PrizeAmount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PrizeCurrency")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceClass")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("RaceDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RaceName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan>("RaceTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<string>("RatingBand")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RawDistanceText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Races");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.Runner", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYears")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BhaRating")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("CourseWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("DecimalOdds")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("DistanceWinner")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ForecastPriceDenominator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ForecastPriceNumerator")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FormFigures")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearAbbreviation")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HeadGearWearingCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("HeadGearWearingSheepSkin")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Odds")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("PenaltyValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<float>("Prediction")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<string>("RaceHorseNameWithoutCountry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ReserveNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RunnerNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SexType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal?>("WeightInGrams")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("WeightText")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WeightValue")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("WeightsJockeyClaiming")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("WindSurgeryFirstRun")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Runners");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.RunnerResult", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("AgeYear")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AnimalId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("BettingRatio")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Bred")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ClothNumber")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("DivisionSequence")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DrawnStall")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("FinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("FinishTimeInMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("HorseId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Hro")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("JockeyId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("JockeyName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("JockeyProfile")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("LossMilliseconds")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("NonRunnerDeclaredDate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("NonRunnerDeclaredReason")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<TimeSpan?>("NonRunnerDeclaredTime")
|
||||
.HasColumnType("time");
|
||||
|
||||
b.Property<int?>("OwnerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("OwnerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("PerformanceFigure")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Plus10")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("PositionFinishTime")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RaceCriteriaRaceType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("RaceId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RacehorseName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RacehorseNameWithoutConuntry")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Ran")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingAwt")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RatingChase")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("RatingFlat")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("RatingHurdle")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultBtnDistance")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ResultFinishDNF")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("ResultFinishPos")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SexType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SilkImage")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("TrainerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TrainerName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("WbSilkDescription")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("WeightValue")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("YearOfRace")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("RunnerResults");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.BetOdds", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.OddsSnapshot", "OddsSnapshot")
|
||||
.WithMany("Odds")
|
||||
.HasForeignKey("OddsSnapshotId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AutoBet.Db.LastRun", b =>
|
||||
{
|
||||
b.HasOne("AutoBet.Db.Runner", null)
|
||||
.WithMany("LastRuns")
|
||||
.HasForeignKey("RunnerId");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
|
||||
<targets>
|
||||
<target name="logfile" xsi:type="File" fileName="file.txt" />
|
||||
<target name="logconsole" xsi:type="Console" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<logger name="*" minlevel="Info" writeTo="logconsole" />
|
||||
<logger name="*" minlevel="Debug" writeTo="logfile" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public class OddsSnapshot
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string EventName { get; set; }
|
||||
public string HorseName { get; set; }
|
||||
public string JockeyName { get; set; }
|
||||
public DateTime SnapshotDate { get; set; }
|
||||
public List<BetOdds> Odds { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public enum OddsType
|
||||
{
|
||||
Back,
|
||||
Lay
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public class Race : Entity
|
||||
{
|
||||
public string DistanceChangeText { get; set; }
|
||||
public int BlackTypeRace { get; set; }
|
||||
public int AbandonedReasonCode { get; set; }
|
||||
public string RaceCriteriaRaceType { get; set; }
|
||||
public string DistanceChange { get; set; }
|
||||
public string DistanceText { get; set; }
|
||||
public int DistanceValue { get; set; }
|
||||
public string DistanceUnits { get; set; }
|
||||
public string RawDistanceText { get; set; }
|
||||
public string RatingBand { get; set; }
|
||||
public int RaceClass { get; set; }
|
||||
public string PrizeCurrency { get; set; }
|
||||
public int PrizeAmount { get; set; }
|
||||
public string AgeLimit { get; set; }
|
||||
public string RaceName { get; set; }
|
||||
public TimeSpan RaceTime { get; set; }
|
||||
public DateTime RaceDate { get; set; }
|
||||
public int DivisionSequence { get; set; }
|
||||
public int YearOfRace { get; set; }
|
||||
public int RaceId { get; set; }
|
||||
public bool Plus10 { get; set; }
|
||||
public int FixtureId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public enum RacePlanningCode
|
||||
{
|
||||
Normal = 0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public enum RacingTrackType
|
||||
{
|
||||
Awt = 0,
|
||||
Turf = 1,
|
||||
Mixed = 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public class Runner : Entity
|
||||
{
|
||||
public string HeadGearWearingCode { get; set; }
|
||||
public int HeadGearWearingSheepSkin { get; set; }
|
||||
public string HeadGearDescription { get; set; }
|
||||
public string HeadGearAbbreviation { get; set; }
|
||||
public int JockeyProfile { get; set; }
|
||||
public string CourseWinner { get; set; }
|
||||
public string DistanceWinner { get; set; }
|
||||
public string WindSurgeryFirstRun { get; set; }
|
||||
public int TrainerId { get; set; }
|
||||
public string TrainerName { get; set; }
|
||||
public int OwnerId { get; set; }
|
||||
public string OwnerName { get; set; }
|
||||
public string WbSilkCode { get; set; }
|
||||
public string WbSilkDescription { get; set; }
|
||||
public string SilkImage { get; set; }
|
||||
public int Plus10 { get; set; }
|
||||
public string ForecastPriceNumerator { get; set; }
|
||||
public string ForecastPriceDenominator { get; set; }
|
||||
public string WeightText { get; set; }
|
||||
public int WeightsJockeyClaiming { get; set; }
|
||||
public string Odds { get; set; }
|
||||
public string JockeyName { get; set; }
|
||||
public Status Status { get; set; }
|
||||
public int RaceId { get; set; }
|
||||
public int YearOfRace { get; set; }
|
||||
public int DivisionSequence { get; set; }
|
||||
public int AnimalId { get; set; }
|
||||
public string RacehorseName { get; set; }
|
||||
public int AgeYears { get; set; }
|
||||
public string Bred { get; set; }
|
||||
public int ClothNumber { get; set; }
|
||||
public int? DrawnStall { get; set; }
|
||||
public string ReserveNumber { get; set; }
|
||||
public string BhaRating { get; set; }
|
||||
public string FormFigures { get; set; }
|
||||
public string WeightValue { get; set; }
|
||||
public int PenaltyValue { get; set; }
|
||||
public SexType SexType { get; set; }
|
||||
public string NonRunnerDeclaredReason { get; set; }
|
||||
public string NonRunnerDeclaredDate { get; set; }
|
||||
public string NonRunnerDeclaredTime { get; set; }
|
||||
public int RunnerNumber { get; set; }
|
||||
public int? JockeyId { get; set; }
|
||||
public List<LastRun> LastRuns { get; set; }
|
||||
public decimal? DecimalOdds { get; set; }
|
||||
public string RaceHorseNameWithoutCountry { get; set; }
|
||||
public decimal? WeightInGrams { get; set; }
|
||||
public float Prediction { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public class RunnerResult : Entity
|
||||
{
|
||||
public int RaceId { get; set; }
|
||||
public int YearOfRace { get; set; }
|
||||
public int DivisionSequence { get; set; }
|
||||
public int HorseId { get; set; }
|
||||
public int AnimalId { get; set; }
|
||||
public int? ResultFinishPos { get; set; }
|
||||
public string Status { get; set; }
|
||||
public int Ran { get; set; }
|
||||
public string NonRunnerDeclaredReason { get; set; }
|
||||
public DateTime? NonRunnerDeclaredDate { get; set; }
|
||||
public TimeSpan? NonRunnerDeclaredTime { get; set; }
|
||||
public string RacehorseName { get; set; }
|
||||
public int AgeYear { get; set; }
|
||||
public string Bred { get; set; }
|
||||
public int? ClothNumber { get; set; }
|
||||
public int? DrawnStall { get; set; }
|
||||
public int? WeightValue { get; set; }
|
||||
public string SexType { get; set; }
|
||||
public int? JockeyId { get; set; }
|
||||
public string JockeyName { get; set; }
|
||||
public int JockeyProfile { get; set; }
|
||||
public int? TrainerId { get; set; }
|
||||
public string TrainerName { get; set; }
|
||||
public int? OwnerId { get; set; }
|
||||
public string OwnerName { get; set; }
|
||||
public string WbSilkCode { get; set; }
|
||||
public string WbSilkDescription { get; set; }
|
||||
public string SilkImage { get; set; }
|
||||
public int Plus10 { get; set; }
|
||||
public string ResultBtnDistance { get; set; }
|
||||
public string PositionFinishTime { get; set; }
|
||||
public string BettingRatio { get; set; }
|
||||
public string PerformanceFigure { get; set; }
|
||||
public int? RatingFlat { get; set; }
|
||||
public string RatingAwt { get; set; }
|
||||
public string RatingChase { get; set; }
|
||||
public string RatingHurdle { get; set; }
|
||||
public string RaceCriteriaRaceType { get; set; }
|
||||
public int Hro { get; set; }
|
||||
public string FinishTime { get; set; }
|
||||
public string ResultFinishDNF { get; set; }
|
||||
public int? FinishTimeInMilliseconds { get; set; }
|
||||
public int? LossMilliseconds { get; set; }
|
||||
public string RacehorseNameWithoutConuntry { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public enum SexType
|
||||
{
|
||||
Filly,
|
||||
Gelding,
|
||||
Colt,
|
||||
Mare,
|
||||
Stallion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace AutoBet.Db
|
||||
{
|
||||
public enum Status
|
||||
{
|
||||
Runner,
|
||||
Dnf,
|
||||
Withdrawn,
|
||||
NonRunner
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BritishHorseRacingApi" Version="1.0.43" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.ML" Version="1.4.0" />
|
||||
<PackageReference Include="Microsoft.ML.FastTree" Version="1.4.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="SuccessfulCodeTools" Version="1.0.8" />
|
||||
<PackageReference Include="System.Data.SqlClient" Version="4.8.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AutoBet.Db\AutoBet.Db.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,16 @@
|
||||
using Microsoft.ML;
|
||||
using Microsoft.ML.Data;
|
||||
using Microsoft.ML.Transforms;
|
||||
|
||||
namespace AutoBet.Learn.Extensions
|
||||
{
|
||||
public static class EstimatorExtensions
|
||||
{
|
||||
//Converts string to one hot encoding vectors
|
||||
public static EstimatorChain<OneHotEncodingTransformer> EncodeColumn(this IEstimator<ITransformer> pipeline, MLContext mlContext, string column)
|
||||
{
|
||||
var catergoricalTransforms = mlContext.Transforms.Categorical;
|
||||
return pipeline.Append(catergoricalTransforms.OneHotEncoding(outputColumnName: column + "Encoded", inputColumnName: column));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
using Microsoft.ML.Data;
|
||||
|
||||
namespace AutoBet.Learn
|
||||
{
|
||||
public class HorseOddsResult
|
||||
{
|
||||
[ColumnName("Score")]
|
||||
public float Odds;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using Microsoft.ML.Data;
|
||||
using System;
|
||||
|
||||
namespace AutoBet.Learn
|
||||
{
|
||||
public class HorseOddsTrainingData
|
||||
{
|
||||
public string CourseName;
|
||||
public int FixtureType;
|
||||
public string RaceCriteriaRaceType;
|
||||
public float DistanceValue;
|
||||
public float RaceClass;
|
||||
public float PrizeAmount;
|
||||
public string HeadGearWearingCode;
|
||||
public int HeadGearWearingSheepSkin;
|
||||
public string CourseWinner;
|
||||
public string DistanceWinner;
|
||||
public string RacehorseName;
|
||||
public string TrainerName;
|
||||
public string OwnerName;
|
||||
public string JockeyName;
|
||||
public float WeightsJockeyClaiming;
|
||||
public float DecimalOdds;
|
||||
public float DivisionSequence;
|
||||
public float AgeYears;
|
||||
public float DrawnStall;
|
||||
public float BhaRating;
|
||||
public string WeightValue;
|
||||
public float PenaltyValue;
|
||||
public int SexType;
|
||||
public float FinishTimeInMilliseconds;
|
||||
public DateTime RaceDateTime;
|
||||
public float RaceYear;
|
||||
public float RaceMonth;
|
||||
public float RaceDay;
|
||||
public float WeightInGrams;
|
||||
}
|
||||
public class HorseOddsTrainingPrediction
|
||||
{
|
||||
[ColumnName("Score")]
|
||||
public float FinishTimeInMilliseconds;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
using Microsoft.ML;
|
||||
using Microsoft.ML.Data;
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using AutoBet.Learn.Extensions;
|
||||
using Microsoft.ML.Trainers;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace AutoBet.Learn
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Learn();
|
||||
Console.WriteLine("Hello World!");
|
||||
}
|
||||
public static DateTime DateToPredict = DateTime.Now.Date.AddDays(-3);
|
||||
private static void Learn()
|
||||
{
|
||||
var daysAgo = DateToPredict.AddMonths(-3);
|
||||
daysAgo = new DateTime(daysAgo.Year, daysAgo.Month, 1);
|
||||
while (DateToPredict != daysAgo)
|
||||
{
|
||||
var mlContext = new MLContext();
|
||||
var model = Train(mlContext);
|
||||
Evaluate(mlContext, model);
|
||||
UpdatePredictions(mlContext, model);
|
||||
DateToPredict = DateToPredict.AddDays(-1);
|
||||
}
|
||||
}
|
||||
|
||||
private static void UpdatePredictions(MLContext mlContext, ITransformer model)
|
||||
{
|
||||
using (var db = new Db.HorseRacingDataContext())
|
||||
{
|
||||
var races = db.Races.Where(e => e.RaceDate == DateToPredict.Date).ToList();
|
||||
foreach (var race in races)
|
||||
{
|
||||
var runners = db.Runners.Where(e => e.RaceId == race.RaceId && e.DecimalOdds != null).ToList();
|
||||
foreach (var runner in runners)
|
||||
{
|
||||
var fixture = db.Fixtures.FirstOrDefault(e => e.FixtureId == race.FixtureId);
|
||||
if (fixture == null)
|
||||
continue;
|
||||
var prediction = TestSinglePrediction(mlContext, model, new HorseOddsTrainingData()
|
||||
{
|
||||
AgeYears = runner.AgeYears,
|
||||
CourseName = fixture.CourseName,
|
||||
FixtureType = (int)fixture.FixtureType,
|
||||
BhaRating = String.IsNullOrWhiteSpace(runner.BhaRating) ? 0 : int.Parse(runner.BhaRating),
|
||||
CourseWinner = runner.CourseWinner,
|
||||
DecimalOdds = (float)runner.DecimalOdds.Value,
|
||||
DistanceValue = race.DistanceValue,
|
||||
DistanceWinner = runner.DistanceWinner,
|
||||
DivisionSequence = race.DivisionSequence,
|
||||
DrawnStall = runner.DrawnStall ?? 0,
|
||||
FinishTimeInMilliseconds = 0,
|
||||
HeadGearWearingCode = runner.HeadGearWearingCode ?? "Unknown",
|
||||
HeadGearWearingSheepSkin = runner.HeadGearWearingSheepSkin,
|
||||
JockeyName = runner.JockeyName,
|
||||
OwnerName = runner.OwnerName,
|
||||
PenaltyValue = runner.PenaltyValue,
|
||||
PrizeAmount = race.PrizeAmount,
|
||||
RaceClass = race.RaceClass,
|
||||
RaceCriteriaRaceType = race.RaceCriteriaRaceType,
|
||||
RaceDateTime = race.RaceDate + race.RaceTime,
|
||||
RacehorseName = runner.RaceHorseNameWithoutCountry,
|
||||
SexType = (int)runner.SexType,
|
||||
TrainerName = runner.TrainerName,
|
||||
WeightInGrams = (float)runner.WeightInGrams,
|
||||
WeightsJockeyClaiming = runner.WeightsJockeyClaiming,
|
||||
WeightValue = runner.WeightValue,
|
||||
RaceDay = (float)race.RaceDate.Day,
|
||||
RaceMonth = (float)race.RaceDate.Month,
|
||||
RaceYear = (float)race.RaceDate.Year
|
||||
});
|
||||
runner.Prediction = prediction;
|
||||
}
|
||||
}
|
||||
db.SaveChanges();
|
||||
}
|
||||
}
|
||||
|
||||
private static IDataView LoadData(MLContext mlContext, string filter = "")
|
||||
{
|
||||
var loader = mlContext.Data.CreateDatabaseLoader<HorseOddsTrainingData>();
|
||||
|
||||
var sqlCommand = @"SELECT
|
||||
[CourseName]
|
||||
,[FixtureType]
|
||||
,[RaceCriteriaRaceType]
|
||||
,[DistanceValue]
|
||||
,[RaceClass]
|
||||
,[PrizeAmount]
|
||||
,[HeadGearWearingCode]
|
||||
,[HeadGearWearingSheepSkin]
|
||||
,[CourseWinner]
|
||||
,[DistanceWinner]
|
||||
,[RacehorseName]
|
||||
,[TrainerName]
|
||||
,[OwnerName]
|
||||
,[JockeyName]
|
||||
,[WeightsJockeyClaiming]
|
||||
,[DecimalOdds]
|
||||
,[DivisionSequence]
|
||||
,[AgeYears]
|
||||
,[DrawnStall]
|
||||
,[BhaRating]
|
||||
,[WeightValue]
|
||||
,[PenaltyValue]
|
||||
,[SexType]
|
||||
,ISNULL([FinishTimeInMilliseconds],0) as FinishTimeInMilliseconds
|
||||
,[RaceDateTime]
|
||||
,[RaceMonth]
|
||||
,[RaceYear]
|
||||
,[RaceDay]
|
||||
,[WeightInGrams]
|
||||
FROM [dbo].[ResultsView] WHERE DecimalOdds IS NOT NULL " + filter;
|
||||
|
||||
var dbSource = new DatabaseSource(SqlClientFactory.Instance, Db.HorseRacingDataContext.ConnectionString, sqlCommand);
|
||||
var data = loader.Load(dbSource);
|
||||
return data;
|
||||
}
|
||||
|
||||
public static ITransformer Train(MLContext mlContext)
|
||||
{
|
||||
var data = LoadData(mlContext, $"AND FinishTimeInMilliseconds IS NOT NULL AND RaceDate < '{DateToPredict.AddDays(-1).ToString("yyyy/MM/dd", null)}'");
|
||||
//var trainers = new Dictionary<string, ITrainerEstimator<ISingleFeaturePredictionTransformer<object>, object>>()
|
||||
//{
|
||||
// { "FastForest", mlContext.Regression.Trainers.FastForest() },
|
||||
// { "FastTree", mlContext.Regression.Trainers.FastTree() },
|
||||
// { "FastTreeTweedie", mlContext.Regression.Trainers.FastTreeTweedie() },
|
||||
// { "LbfgsPoissonRegression", mlContext.Regression.Trainers.LbfgsPoissonRegression() },
|
||||
// { "Scda", mlContext.Regression.Trainers.Sdca() }
|
||||
//};
|
||||
|
||||
//foreach (var trainer in trainers)
|
||||
//{
|
||||
// var modelPipeline = DataTransform(mlContext);
|
||||
// var pipelineWithTrainer = modelPipeline.Append(trainer.Value);
|
||||
|
||||
// var model = pipelineWithTrainer.Fit(data);
|
||||
// Console.WriteLine($">>>>>>> Evaluating algorithm: {trainer.Key} <<<<<<<");
|
||||
// Evaluate(mlContext, model);
|
||||
//}
|
||||
|
||||
|
||||
Console.WriteLine($"Loading data");
|
||||
var pipeline = DataTransform(mlContext);
|
||||
|
||||
//var pipelineWithTrainer = pipeline.Append(mlContext.Regression.Trainers.LbfgsPoissonRegression());
|
||||
|
||||
var selectedPipelineWithTrainer = pipeline.Append(pipeline.Append(mlContext.Regression.Trainers.LbfgsPoissonRegression()));
|
||||
var finalModel = selectedPipelineWithTrainer.Fit(data);
|
||||
|
||||
return finalModel;
|
||||
}
|
||||
|
||||
private static EstimatorChain<ColumnConcatenatingTransformer> DataTransform(MLContext mlContext)
|
||||
{
|
||||
var pipeline = mlContext.Transforms
|
||||
.CopyColumns(outputColumnName: "Label", inputColumnName: "FinishTimeInMilliseconds")
|
||||
.EncodeColumn(mlContext, "CourseName")
|
||||
.EncodeColumn(mlContext, "FixtureType")
|
||||
.EncodeColumn(mlContext, "RaceCriteriaRaceType")
|
||||
.EncodeColumn(mlContext, "HeadGearWearingCode")
|
||||
.EncodeColumn(mlContext, "RacehorseName")
|
||||
.EncodeColumn(mlContext, "TrainerName")
|
||||
.EncodeColumn(mlContext, "OwnerName")
|
||||
.EncodeColumn(mlContext, "JockeyName")
|
||||
.EncodeColumn(mlContext, "HeadGearWearingSheepSkin")
|
||||
.EncodeColumn(mlContext, "CourseWinner")
|
||||
.EncodeColumn(mlContext, "DistanceWinner")
|
||||
.EncodeColumn(mlContext, "WeightValue")
|
||||
.EncodeColumn(mlContext, "SexType")
|
||||
.Append(mlContext.Transforms.Concatenate("Features",
|
||||
"CourseNameEncoded",
|
||||
"FixtureTypeEncoded",
|
||||
"RaceCriteriaRaceTypeEncoded",
|
||||
"DistanceValue",
|
||||
"RaceClass",
|
||||
"PrizeAmount",
|
||||
"HeadGearWearingCodeEncoded",
|
||||
"HeadGearWearingSheepSkinEncoded",
|
||||
"CourseWinnerEncoded",
|
||||
"DistanceWinnerEncoded",
|
||||
"RacehorseNameEncoded",
|
||||
"TrainerNameEncoded",
|
||||
"OwnerNameEncoded",
|
||||
"JockeyNameEncoded",
|
||||
"WeightsJockeyClaiming",
|
||||
"DecimalOdds",
|
||||
"DivisionSequence",
|
||||
"AgeYears",
|
||||
"DrawnStall",
|
||||
"WeightValueEncoded",
|
||||
"PenaltyValue",
|
||||
"SexTypeEncoded",
|
||||
"RaceMonth",
|
||||
"RaceYear",
|
||||
"RaceDay"));
|
||||
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
private static RegressionMetrics Evaluate(MLContext mlContext, ITransformer model)
|
||||
{
|
||||
var dataView = LoadData(mlContext, $"AND FinishTimeInMilliseconds IS NOT NULL AND RaceDate = '{DateToPredict.AddDays(-1).ToString("yyyy/MM/dd", null)}'");
|
||||
var predictions = model.Transform(dataView);
|
||||
var metrics = mlContext.Regression.Evaluate(predictions, "Label", "Score");
|
||||
Console.WriteLine();
|
||||
|
||||
|
||||
var result = $"* Model quality metrics evaluation R2: {metrics.RSquared:0.####} Root Mean Squared Error: {metrics.RootMeanSquaredError:#.####} *";
|
||||
var stars = String.Concat(Enumerable.Range(0, result.Length).Select(e => "*"));
|
||||
|
||||
Console.WriteLine(stars);
|
||||
Console.WriteLine(result);
|
||||
Console.WriteLine(stars);
|
||||
|
||||
Console.WriteLine();
|
||||
return metrics;
|
||||
}
|
||||
|
||||
private static float TestSinglePrediction(MLContext mlContext, ITransformer model, HorseOddsTrainingData values)
|
||||
{
|
||||
var predictionFunction = mlContext.Model.CreatePredictionEngine<HorseOddsTrainingData, HorseOddsTrainingPrediction>(model);
|
||||
var prediction = predictionFunction.Predict(values);
|
||||
Console.WriteLine($"Predicted time for {values.RacehorseName}: {prediction.FinishTimeInMilliseconds}");
|
||||
return prediction.FinishTimeInMilliseconds;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29424.173
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoBet.Core", "AutoBet.Core\AutoBet.Core.csproj", "{42403004-C636-46BF-B337-166A8EA583F8}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoBet.Core.Tests", "AutoBet.Core.Tests\AutoBet.Core.Tests.csproj", "{48657C18-836A-4556-84A9-8C521B58993B}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoBet.ApiGenerator", "AutoBet.ApiGenerator\AutoBet.ApiGenerator.csproj", "{0AFF4C6B-F6F7-4B70-BA5F-5D68FB89AE7A}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AutoBet.DataRecorded", "AutoBet.DataRecorded\AutoBet.DataRecorded.csproj", "{3CFBBC04-ED1D-4A82-8479-83CD7E49954E}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A43D1F10-EDE6-4123-A20B-55CACFA2070F}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoBet.Db", "AutoBet.Db\AutoBet.Db.csproj", "{250314C9-8EDD-4C37-9E07-96005A2D8B24}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoBet.Learn", "AutoBet.Learn\AutoBet.Learn.csproj", "{F8FAB0EB-6A35-4413-9961-317C52141924}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{42403004-C636-46BF-B337-166A8EA583F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{42403004-C636-46BF-B337-166A8EA583F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{42403004-C636-46BF-B337-166A8EA583F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{42403004-C636-46BF-B337-166A8EA583F8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{48657C18-836A-4556-84A9-8C521B58993B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{48657C18-836A-4556-84A9-8C521B58993B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{48657C18-836A-4556-84A9-8C521B58993B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{48657C18-836A-4556-84A9-8C521B58993B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0AFF4C6B-F6F7-4B70-BA5F-5D68FB89AE7A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0AFF4C6B-F6F7-4B70-BA5F-5D68FB89AE7A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0AFF4C6B-F6F7-4B70-BA5F-5D68FB89AE7A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0AFF4C6B-F6F7-4B70-BA5F-5D68FB89AE7A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3CFBBC04-ED1D-4A82-8479-83CD7E49954E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3CFBBC04-ED1D-4A82-8479-83CD7E49954E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3CFBBC04-ED1D-4A82-8479-83CD7E49954E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3CFBBC04-ED1D-4A82-8479-83CD7E49954E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{250314C9-8EDD-4C37-9E07-96005A2D8B24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{250314C9-8EDD-4C37-9E07-96005A2D8B24}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{250314C9-8EDD-4C37-9E07-96005A2D8B24}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{250314C9-8EDD-4C37-9E07-96005A2D8B24}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F8FAB0EB-6A35-4413-9961-317C52141924}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F8FAB0EB-6A35-4413-9961-317C52141924}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F8FAB0EB-6A35-4413-9961-317C52141924}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F8FAB0EB-6A35-4413-9961-317C52141924}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3346276E-6029-44D9-A4C5-7432137B0348}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Reference in New Issue
Block a user