.net Modelコンテキストクラス

1212 ワード

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;
using System.Data.Entity.ModelConfiguration.Conventions;
namespace zhlyBackGround.Models
{
    public class UserInfoDbContext : DbContext
    {
        public UserInfoDbContext()
            : base("name=MusicStoreEntities")
        {
        }
        public DbSet UserInfoGerry { get; set; }
        public DbSet BookInfo { get; set; }
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove();//      
        }
    }


    public class UserInfoGerry
    {
        [DisplayName("  ")]
        public int id { get; set; }
        [DisplayName("  ")]
        public string name { get; set; }
        [DisplayName("  ")]
        public string sex { get; set; }
        [DisplayName("  ")]
        public int age { get; set; }
    }


}