Esempio n. 1
0
        public void Init()
        {
            var mapperConfiguration = new MapperConfiguration(cfg => cfg.AddProfile <AutoMapperProfile>());

            this.mapper = mapperConfiguration.CreateMapper();

            var options = new DbContextOptionsBuilder <DatabaseContext>()
                          .UseInMemoryDatabase(databaseName: "Temporal")
                          .Options;

            this.context = new DatabaseContext(options);
            this.context.CatCatalogos.AddRange(this.GetAllCatalogoss());
            this.context.SaveChanges();

            this.modelDao      = new CatalogosDao(this.context);
            this.modelServices = new CatalogosService(this.mapper, this.modelDao);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CatalogosService"/> class.
 /// </summary>
 /// <param name="mapper">Object to mapper.</param>
 /// <param name="modelDao">Object to modelDao.</param>
 public CatalogosService(IMapper mapper, ICatalogosDao modelDao)
 {
     this.mapper   = mapper;
     this.modelDao = modelDao ?? throw new ArgumentNullException(nameof(modelDao));
 }