Horje
ef core seed data bogus data without migration Code Example
ef core seed data bogus data without migration
  public static class SeedDatabase
{
    public static void Initialize(IServiceProvider serviceProvider)
    {
        using (var context = new HospitalManagementDbContext(serviceProvider.GetRequiredService<DbContextOptions<HospitalManagementDbContext>>()))
        {
            if (context.InvestigationTags.Any())
            {
                return;
            }

            context.InvestigationTags.AddRange(
                new Models.InvestigationTag
                {
                    Abbreviation = "A1A",
                    Name = "Alpha-1 Antitrypsin"
                },

                new Models.InvestigationTag
                {
                    Abbreviation = "A1c",
                    Name = "Hemoglobin A1c"
                },


                new Models.InvestigationTag
                {
                    Abbreviation = "Alk Phos",
                    Name = "Alkaline Phosphatase"
                }
                );
            context.SaveChanges();
        }
    }
}




Csharp

Related
how to show a first item in a combobox in c# winforms Code Example how to show a first item in a combobox in c# winforms Code Example
override indexation C# Code Example override indexation C# Code Example
"??" in C# Code Example "??" in C# Code Example
prime number generator Code Example prime number generator Code Example
you have the following c# code. sb is a a very long string. you need to identify whether a string stored in an object named stringtofind is within the stringbuilder sb object. which code shou you have the following c# code. sb is a a very long string. you need to identify whether a string stored in an object named stringtofind is within the stringbuilder sb object. which code shou

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11