Интерфейсы репозиториев, репозитории и unity контейнер
This commit is contained in:
parent
b2c8a278be
commit
9dd158bd4c
@ -1,6 +1,6 @@
|
|||||||
namespace ProjectRacing
|
namespace ProjectRacing
|
||||||
{
|
{
|
||||||
partial class Form1
|
partial class FormRacing
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
@ -1,8 +1,8 @@
|
|||||||
namespace ProjectRacing
|
namespace ProjectRacing
|
||||||
{
|
{
|
||||||
public partial class Form1 : Form
|
public partial class FormRacing : Form
|
||||||
{
|
{
|
||||||
public Form1()
|
public FormRacing()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
@ -1,3 +1,7 @@
|
|||||||
|
using ProjectRacing.Repositories;
|
||||||
|
using ProjectRacing.Repositories.Implementations;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
namespace ProjectRacing
|
namespace ProjectRacing
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
@ -11,7 +15,18 @@ namespace ProjectRacing
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new Form1());
|
Application.Run(CreateContainer().Resolve<FormRacing>());
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IUnityContainer CreateContainer()
|
||||||
|
{
|
||||||
|
var container = new UnityContainer();
|
||||||
|
container.RegisterType<ICompetitionsRepository, CompetitionsRepository>();
|
||||||
|
container.RegisterType<IHorseRepository, HorseRepository>();
|
||||||
|
container.RegisterType<IJockeyRepository, JockeyRepository>();
|
||||||
|
container.RegisterType<IOwnerRepository, OwnerRepository>();
|
||||||
|
container.RegisterType<IParticipantsRepository, ParticipantsRepository>();
|
||||||
|
return container;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,4 +8,8 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Unity" Version="5.11.10" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
11
ProjectRacing/Repositories/ICompetitionsRepository.cs
Normal file
11
ProjectRacing/Repositories/ICompetitionsRepository.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using ProjectRacing.Entities;
|
||||||
|
|
||||||
|
namespace ProjectRacing.Repositories;
|
||||||
|
public interface ICompetitionsRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Competitions> GetCompetitionses();
|
||||||
|
Competitions GetCompetitionsById(int id);
|
||||||
|
void CreateCompetitions(Competitions competitions);
|
||||||
|
void UpdateCompetitions(Competitions competitions);
|
||||||
|
void DeleteCompetitions(int id);
|
||||||
|
}
|
10
ProjectRacing/Repositories/IHorseRepository.cs
Normal file
10
ProjectRacing/Repositories/IHorseRepository.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using ProjectRacing.Entities;
|
||||||
|
namespace ProjectRacing.Repositories;
|
||||||
|
public interface IHorseRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Horse> GetHorses();
|
||||||
|
Horse GetHorseById(int id);
|
||||||
|
void CreateHorse(Horse horse);
|
||||||
|
void UpdateHorse(Horse horse);
|
||||||
|
void DeleteHorse(int id);
|
||||||
|
}
|
11
ProjectRacing/Repositories/IJockeyRepository.cs
Normal file
11
ProjectRacing/Repositories/IJockeyRepository.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using ProjectRacing.Entities;
|
||||||
|
|
||||||
|
namespace ProjectRacing.Repositories;
|
||||||
|
public interface IJockeyRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Jockey> GetJockeys();
|
||||||
|
Jockey GetJockeyById(int id);
|
||||||
|
void CreateJockey(Jockey jockey);
|
||||||
|
void UpdateJockey(Jockey jockey);
|
||||||
|
void DeleteJockey(int id);
|
||||||
|
}
|
11
ProjectRacing/Repositories/IOwnerRepository.cs
Normal file
11
ProjectRacing/Repositories/IOwnerRepository.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using ProjectRacing.Entities;
|
||||||
|
|
||||||
|
namespace ProjectRacing.Repositories;
|
||||||
|
public interface IOwnerRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Owner> GetOwner();
|
||||||
|
Owner GetOwnerById(int id);
|
||||||
|
void CreateOwner(Owner owner);
|
||||||
|
void UpdateOwner(Owner owner);
|
||||||
|
void DeleteOwner(int id);
|
||||||
|
}
|
11
ProjectRacing/Repositories/IParticipantsRepository.cs
Normal file
11
ProjectRacing/Repositories/IParticipantsRepository.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
using ProjectRacing.Entities;
|
||||||
|
|
||||||
|
namespace ProjectRacing.Repositories;
|
||||||
|
public interface IParticipantsRepository
|
||||||
|
{
|
||||||
|
IEnumerable<Participants> GetParticipants();
|
||||||
|
Participants GetParticipantsById(int id);
|
||||||
|
void CreateParticipants(Participants participants);
|
||||||
|
void UpdateParticipants(Participants participants);
|
||||||
|
void DeleteParticipants(int id);
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
using ProjectRacing.Entities;
|
||||||
|
namespace ProjectRacing.Repositories.Implementations;
|
||||||
|
internal class CompetitionsRepository : ICompetitionsRepository
|
||||||
|
{
|
||||||
|
public void CreateCompetitions(Competitions competitions)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteCompetitions(int id)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Competitions GetCompetitionsById(int id)
|
||||||
|
{
|
||||||
|
return Competitions.CreateEntity(0, new DateOnly(0001,1,1), string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Competitions> GetCompetitionses()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateCompetitions(Competitions competitions)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
using ProjectRacing.Entities;
|
||||||
|
namespace ProjectRacing.Repositories.Implementations;
|
||||||
|
public class HorseRepository : IHorseRepository
|
||||||
|
{
|
||||||
|
public void CreateHorse(Horse horse)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteHorse(int id)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Horse GetHorseById(int id)
|
||||||
|
{
|
||||||
|
return Horse.CreateEntity(0, string.Empty, true, new DateOnly(0001, 1, 1), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Horse> GetHorses()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateHorse(Horse horse)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
using ProjectRacing.Entities;
|
||||||
|
namespace ProjectRacing.Repositories.Implementations;
|
||||||
|
internal class JockeyRepository : IJockeyRepository
|
||||||
|
{
|
||||||
|
public void CreateJockey(Jockey jockey)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteJockey(int id)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Jockey GetJockeyById(int id)
|
||||||
|
{
|
||||||
|
return Jockey.CreateEntity(0, string.Empty, 0, 0, string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Jockey> GetJockeys()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateJockey(Jockey jockey)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
using ProjectRacing.Entities;
|
||||||
|
namespace ProjectRacing.Repositories.Implementations;
|
||||||
|
internal class OwnerRepository : IOwnerRepository
|
||||||
|
{
|
||||||
|
public void CreateOwner(Owner owner)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteOwner(int id)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Owner> GetOwner()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Owner GetOwnerById(int id)
|
||||||
|
{
|
||||||
|
return Owner.CreateEntity(0, string.Empty, string.Empty);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateOwner(Owner owner)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
using ProjectRacing.Entities;
|
||||||
|
namespace ProjectRacing.Repositories.Implementations;
|
||||||
|
internal class ParticipantsRepository : IParticipantsRepository
|
||||||
|
{
|
||||||
|
public void CreateParticipants(Participants participants)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeleteParticipants(int id)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Participants> GetParticipants()
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Participants GetParticipantsById(int id)
|
||||||
|
{
|
||||||
|
return Participants.CreateEntity(0, 0, 0, 0, TimeSpan.Zero, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UpdateParticipants(Participants participants)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user