Exemple #1
0
        public static void AddContext(this IServiceCollection services)
        {
            var options = new DbContextOptionsBuilder <MovieRentalSystemContext>()
                          .UseInMemoryDatabase("MovieRentalSystem")
                          .ConfigureWarnings(x => x.Ignore(InMemoryEventId.TransactionIgnoredWarning))
                          .Options;

            var context = new MovieRentalSystemContext(options);

            //coloquei Singleton nesse caso pelo fato de está trabalhando com os dados in memory.
            services.AddSingleton(context);
        }
Exemple #2
0
 public RepositoryBase(MovieRentalSystemContext context)
 {
     this.context = context;
 }