Model first (VS2015 ,Sql Server2014)
新建MVC项目
![](https://i-blog.csdnimg.cn/blog_migrate/e54c2c37dfce3f99116bad42cccfe56e.png)
![](https://i-blog.csdnimg.cn/blog_migrate/4fd998158d80676cf38c64feaff6ed92.png)
![](https://i-blog.csdnimg.cn/blog_migrate/7cbc2164b5d6366efca6c0493fc7f8d1.png)
![](https://i-blog.csdnimg.cn/blog_migrate/0821386e4052d4ef097108f40d4cb5c5.png)
![](https://i-blog.csdnimg.cn/blog_migrate/3a991edbe06c880c2cd6b8e69561ea0f.png)
![](https://i-blog.csdnimg.cn/blog_migrate/4bdc84b5d6ae3580c77fe918e2f1e496.png)
右键product ,新增标量属性(数据库表中的字段)
![](https://i-blog.csdnimg.cn/blog_migrate/8a0ff4701613c69715e7249f91651799.png)
Ctrl + S 保存页面,右键“根据模型生成数据库”
![](https://i-blog.csdnimg.cn/blog_migrate/6a94999f59b4d0f82b7166b44a44d639.png)
![](https://i-blog.csdnimg.cn/blog_migrate/bc6fadf68dc6758a1c9737f8754a0344.png)
![](https://i-blog.csdnimg.cn/blog_migrate/b79b082d35c1b8d2956b1dfb013d0307.png)
![](https://i-blog.csdnimg.cn/blog_migrate/a8c544c829c8999b53c6c88368de59ee.png)
![](https://i-blog.csdnimg.cn/blog_migrate/f656e1287830832c968d612e7bc3e8bc.png)
![](https://i-blog.csdnimg.cn/blog_migrate/0b5f01876fa7327d6ef770f7728d2cb1.png)
![](https://i-blog.csdnimg.cn/blog_migrate/7fb30ab5fd145167715f364ff33f02b9.png)
![](https://i-blog.csdnimg.cn/blog_migrate/c3da96f91ad583e06e12eabea478bb3d.png)
实例:
![](https://i-blog.csdnimg.cn/blog_migrate/6e45a30d145e347bef0663bc2770ce39.png)
源码地址:http://note.youdao.com/noteshare?id=f09484de58f75bf07cc3667eb4b248cc
转载于:https://www.cnblogs.com/om88mo/p/10941859.html