/// <summary> /// Initializes a new istance of the <see cref="StadiumsController"/> class. /// </summary> /// <param name="_context">Context instance</param> /// <param name="_logger">Logger instance</param> /// <param name="_mapper">Mapper instance</param> public StadiumsController(FootballManagerContext context, IStadiumRepository repository, ILogger <StadiumsController> logger, IMapper mapper) { _context = context; _repository = repository; _logger = logger; _mapper = mapper; }
/// <summary> /// Initializes a new istance of the <see cref="ClubsController"/> class. /// </summary> /// <param name="_context">Context instance</param> /// <param name="_logger">Logger instance</param> /// <param name="_mapper">Mapper instance</param> public ClubsController(FootballManagerContext context, IClubRepository repository, ILogger <ClubsController> logger, IMapper mapper) { _context = context; _repository = repository; _logger = logger; _mapper = mapper; }
public void CanInsertClubIntoDatabase() { var builder = new DbContextOptionsBuilder(); builder.UseInMemoryDatabase("CanInsertClub"); using (var context = new FootballManagerContext(builder.Options)) { var club = new Club(); context.Clubs.Add(club); Assert.AreEqual(EntityState.Added, context.Entry(club).State); } }
static void Main(string[] args) { var fm = new FootballManagerContext(); var count = fm.FootballClub.Count(); Console.WriteLine(count); var fm1 = new FootballManagerContext(); count = fm.FootballClub.Count(); Console.WriteLine(count); Console.ReadKey(); }
public static void AddFootballerToExistingClubNotTracked(int clubId) { var club = _context.Clubs.Find(clubId); club.Footballers.Add(new Footballer { Name = "Piere-Emerick", Surname = "Aubameyang", ClubId = 1 }); using (var newContext = new FootballManagerContext()) { newContext.Clubs.Update(club); newContext.SaveChanges(); } }
public void CanInsertSamuraiIntoDatabase() { using (var context = new FootballManagerContext()) { context.Database.EnsureCreated(); var club = new Club(); context.Clubs.Add(club); Debug.WriteLine($"Before save: {club.Id}"); context.SaveChanges(); Debug.WriteLine($"After save: {club.Id}"); Assert.AreNotEqual(0, club.Id); } }
public CommandService(FootballManagerContext context) : base(context) { }
public EfPlayerRepository(FootballManagerContext context) : base(context) { }
public BuisnessDataLogic() { _context = new FootballManagerContext(); }
public ClubRepository(FootballManagerContext context, ILogger <ClubRepository> logger) { _context = context; _logger = logger; }
public BuisnessDataLogic(FootballManagerContext context) { _context = context; }
public EfTournamentRepository(FootballManagerContext context) : base(context) { }
public StadiumRepository(FootballManagerContext context, ILogger <StadiumRepository> logger) { _context = context; _logger = logger; }
public MatchService(FootballManagerContext context) : base(context) { }
public ChampionshipCommandService(FootballManagerContext context) : base(context) { }
public EfUserRepositiory(FootballManagerContext context) : base(context) { }
public EfMatchRepository(FootballManagerContext context) : base(context) { }
public PlayerService(FootballManagerContext context) : base(context) { }
public EfClubRepository(FootballManagerContext context) : base(context) { }
public EfRepository(FootballManagerContext context) { Context = context; Entities = context.Set <T>(); }