Outline

Solution: Create Profile Repository

In the Conduit.Repositories Project:

Create a new Interface Class

Call it IProfileRepository

Here's the code for IProfileRepository.cs file:

namespace Conduit.Repositories
{
    public interface IProfileRepository
    {
    }
}
Create a new class
  • Name it ProfileRepository
  • Implement the IProfileRepository Interface
Inject the following objects into ProfileRepository
  • IAccountRepository
  • ConduitContext
  • IMapper
  • Ilogger

Here's the code for ProfileRepository.cs file:

using AutoMapper;
using Conduit.Data;
using Microsoft.Extensions.Logging;

namespace Conduit.Repositories
{
    public class ProfileRepository : IProfileRepository
    {
        private IAccountRepository AccountRepo;
        private ConduitContext Context;
        private IMapper Mapper;
        private ILogger<ProfileRepository> Logger;

        public ProfileRepository(
            IAccountRepository accountRepo, 
            ConduitContext context, 
            IMapper mapper, 
            ILogger<ProfileRepository> logger)
        {
            AccountRepo = accountRepo;
            Context = context;
            Mapper = mapper;
            Logger = logger;
        }
    }
}
 

I finished! On to the next chapter