private static async Task Run(ProfileReaderFacade profileReader) { try { Profile profile = await profileReader.GetByUsername("SingletonSean"); Console.WriteLine(profile); } catch (ForbiddenProfileReadException) { Console.WriteLine("Profile is private."); } }
static async Task Main(string[] args) { DbContextOptions options = new DbContextOptionsBuilder().UseInMemoryDatabase("users").Options; UsersDbContext context = new UsersDbContext(options); await Seed(context); DatabaseUserRepository userRepository = new DatabaseUserRepository(context); FileUserPreferencesRepository userPreferencesRepository = new FileUserPreferencesRepository(); ProfileReaderFacade profileReader = new ProfileReaderFacade(userRepository, userPreferencesRepository); await Run(profileReader); }