原文:http://www.entityframeworktutorial.net/code-first/configure-property-mappings-using-fluent-api.aspx 本节,我们将学习如何使用Fluent API配置实体类的属性. 我们将使用我们学校app的Student和Standard域类: public class Student { public Student() { } public int StudentKey { get; set; } pu…
winform窗体的样式很单一,不够漂亮,往往我们需要对窗体进行重写,但是我们又要保留在重写前窗体本身带的功能,例如拖动窗体的头进行移动之类的. 一下方式可以实现该方法: [DllImport("user32")] public static extern int ReleaseCapture(); [DllImport("user32")] public static extern int SendMessage(IntPtr hwnd, int msg, int…
一. 本地缓存 从这个章节开始,介绍一下EF的一些高级特性,这里介绍的首先介绍的EF的本地缓存,在前面的“EF增删改”章节中介绍过该特性(SaveChanges一次性会作用于本地缓存中所有的状态的变化),在这里介绍一下本地缓存的另外一个用途. ① Find方法通过主键查询数据,主键相同的查询,只有第一次访问数据库,其它均从缓存中读取. ② 延迟加载的数据,在第一次使用的使用时访问数据库,后面无论再使用多少次,均是从内存中读取了. Console.WriteLine("--------------…
原文:http://www.entityframeworktutorial.net/entityframework6/index-attribute-in-code-first.aspx Entity Framework 6提供了Index属性来创建数据库中特定列的Index,如下所示: class Student { public Student() { } public int Student_ID { get; set; } public string StudentName { get;…