예제 #1
0
        public CatalogActivosController(ActivosContext catalogcontext, IOptionsSnapshot <ActivosSettings> settings)
        {
            _catalogcontext = catalogcontext;
            _settings       = settings;
            ((DbContext)catalogcontext).ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.NoTracking;

            string url = settings.Value.ExternalActivosBaseUrl;
        }
예제 #2
0
        public static async Task SeedAsync(ActivosContext context)


        //  public static void SeedAsync(ActivosContext context)
        {
            //esto sirve para que se cree la migracion automaticamente
            context.Database.Migrate();
            if (!context.TipoActivos.Any())
            {
                context.TipoActivos.AddRange(GetPreconfiguredTipoActivos());
                await context.SaveChangesAsync();

                //context.SaveChanges();
            }
            if (!context.CatalogActivos.Any())
            {
                context.CatalogActivos.AddRange(GetPreconfiguredCatalogActivos());
                await context.SaveChangesAsync();

                //context.SaveChanges();
            }
        }