コード例 #1
0
        public static void Seed(IServiceProvider applicationBuilder)
        {
            AppDbContext context = applicationBuilder.GetRequiredService <AppDbContext>();

/*                if (!context.Categories.Any())
 *          {
 *              context.Categories.AddRange(Categories.Select(c => c.Value));
 *          }
 */

            if (!context.PaymentMethods.Any())
            {
                context.PaymentMethods.AddRange(PaymentMethods.Select(c => c.Value));
            }

            if (!context.RentalAssets.Any())
            {
                context.AddRange
                (
                );
            }

            context.SaveChanges();
        }