コード例 #1
0
 /// <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;
 }
コード例 #2
0
 /// <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;
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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();
        }
コード例 #5
0
        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();
            }
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
 public CommandService(FootballManagerContext context) : base(context)
 {
 }
コード例 #8
0
 public EfPlayerRepository(FootballManagerContext context) : base(context)
 {
 }
コード例 #9
0
 public BuisnessDataLogic()
 {
     _context = new FootballManagerContext();
 }
コード例 #10
0
 public ClubRepository(FootballManagerContext context, ILogger <ClubRepository> logger)
 {
     _context = context;
     _logger  = logger;
 }
コード例 #11
0
 public BuisnessDataLogic(FootballManagerContext context)
 {
     _context = context;
 }
コード例 #12
0
 public EfTournamentRepository(FootballManagerContext context) : base(context)
 {
 }
コード例 #13
0
 public StadiumRepository(FootballManagerContext context, ILogger <StadiumRepository> logger)
 {
     _context = context;
     _logger  = logger;
 }
コード例 #14
0
ファイル: MatchService.cs プロジェクト: Vladoffz/API-Auth
 public MatchService(FootballManagerContext context) : base(context)
 {
 }
コード例 #15
0
 public ChampionshipCommandService(FootballManagerContext context) : base(context)
 {
 }
コード例 #16
0
 public EfUserRepositiory(FootballManagerContext context) : base(context)
 {
 }
コード例 #17
0
 public EfMatchRepository(FootballManagerContext context) : base(context)
 {
 }
コード例 #18
0
ファイル: PlayerService.cs プロジェクト: Vladoffz/API-Auth
 public PlayerService(FootballManagerContext context) : base(context)
 {
 }
コード例 #19
0
 public EfClubRepository(FootballManagerContext context) : base(context)
 {
 }
コード例 #20
0
 public EfRepository(FootballManagerContext context)
 {
     Context  = context;
     Entities = context.Set <T>();
 }