예제 #1
0
        private readonly BandAlbumContext _db; // Made it private readonly because we only want to read values from the database. Underscore is a good choice to put before private variable names.

        public BandAlbumRepository(BandAlbumContext db)
        {
            //Part from ?? checks if the context/database sent is empty. If empty, it throws an error
            //with the name of db otherwise our injection is successfull. ?? is to check if smth is null.
            _db = db ?? throw new ArgumentNullException(nameof(db));
        }
예제 #2
0
 public BandAlbumRepository(BandAlbumContext context)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
 }
예제 #3
0
 public BandAlbumRepository(BandAlbumContext context, IPropertyMappingService propertyMappingService)
 {
     _context = context ?? throw new ArgumentNullException(nameof(context));
     _propertyMappingService = propertyMappingService;
 }