public static void Seed(MainContext context)
 {
     MovieSeed.Initialize(context);
     StudentSeed.Initialize(context);
     InstructorSeed.Initialize(context);
     DepartmentSeed.Initialize(context);
     CourseSeed.Initialize(context);
     OfficeAssignmentSeed.Initialize(context);
     CourseAssignmentSeed.Initialize(context);
     EnrollmentSeed.Initialize(context);
 }
Esempio n. 2
0
 private static void Seed(VideoStoreDbContext context)
 {
     context.Genres.AddRange(GenreSeed.Seed());
     context.Person.AddRange(PeopleSeed.Seed());
     context.ProductionCompanies.AddRange(ProductionCompanySeed.Seed());
     context.Movies.AddRange(MovieSeed.Seed());
     context.MovieGenre.AddRange(MovieGenreSeed.Seed());
     context.MovieActor.AddRange(MovieActorSeed.Seed());
     context.MovieDirector.AddRange(MovieDirectorSeed.Seed());
     context.MovieProductionCompany.AddRange(MovieProductionCompanySeed.Seed());
     context.SaveChanges();
 }
        public void Configure(EntityTypeBuilder <Movie> builder)
        {
            builder.HasKey(p => p.Id);

            builder.HasIndex(p => p.Title).IsUnique();

            builder.Property(p => p.Active)
            .HasDefaultValue(true);

            builder.Property(p => p.Popularity)
            .HasDefaultValue(0);

            builder.Property(p => p.VoteAvarage)
            .HasDefaultValue(0);

            builder.Property(p => p.VoteCount)
            .HasDefaultValue(0);

            builder.Property(p => p.CreatedAt)
            .HasDefaultValueSql("getdate()");

            builder.HasData(MovieSeed.Seed());
        }