随笔分类 -  EF

摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Data.Entity;using System.Data.Entity.ModelConfiguration... 阅读全文
posted @ 2016-01-21 09:16 jamess 阅读(197) 评论(0) 推荐(0)
摘要:AutoMapper是用来解决对象之间映射转换的类库。对于我们开发人员来说,写对象之间互相转换的代码是一件极其浪费生命的事情,AutoMapper能够帮助我们节省不少时间。 阅读全文
posted @ 2015-11-25 09:52 jamess 阅读(312) 评论(0) 推荐(0)
摘要:要在nuget 程序包管理控制台中输入命令基本命令Enable-Migrations //打开数据库迁移Add-MigrationAddBlogUrl //新增一个数据库迁移版本 AddBlogUrl是要新增版本名称,这个名称必须是唯一的,不能重复Update-Database //更新数据库U... 阅读全文
posted @ 2015-10-12 17:18 jamess 阅读(307) 评论(0) 推荐(0)
摘要:示例: public class Phone { [Key] //主键 public int Id { get; set; } [Required] //不能为空 [MinLength(2),MaxLength(20)] //最小... 阅读全文
posted @ 2015-10-12 17:07 jamess 阅读(230) 评论(0) 推荐(0)
摘要:1 从nuget中搜索并添加EF2 在app.config或web.config中添加数据库连接 3 新建一个实体类public class Phone { public int Id { get; set; } public string Name { ... 阅读全文
posted @ 2015-10-12 16:54 jamess 阅读(249) 评论(0) 推荐(0)