C# EF 读取App.config连接字符串
在Entiites里面创建
using System; using System.ComponentModel.DataAnnotations.Schema; using System.Configuration; using System.Data.Entity; using System.Linq; using HRMS.Model; namespace HRMS.SQLServerDAL { public partial class Entities : DbContext { private static string connString = ConfigurationManager.ConnectionStrings["connString"].ToString(); public Entities() : base(connString) { } public virtual DbSet<PD_Bank> PD_Bank { get; set; } protected override void OnModelCreating(DbModelBuilder modelBuilder) { } } }