Beispiel #1
0
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder
            .Configurations
            .Add(User.CreateConfiguration());

            modelBuilder
            .Configurations
            .Add(Session.CreateConfiguration());

            modelBuilder
            .Configurations
            .Add(ImageInfo.CreateConfiguration());

            //modelBuilder
            //    .Entity<User>()
            //    .HasMany(c => c.Sessions)
            //    .WithRequired(e => e.User)
            //    .HasForeignKey(o => o.Id);

            //modelBuilder
            //    .Entity<Session>()
            //    .HasRequired(c => c.User)
            //    .WithMany(e => e.Sessions)
            //    .HasForeignKey(o => o.UserId);

            //modelBuilder
            //    .Entity<ImageInfo>()
            //    .HasRequired(e => e.Session)
            //    .WithMany(e => e.Images)
            //    .HasForeignKey(o => o.SessionId);

            base.OnModelCreating(modelBuilder);
        }