asp.net entity framework code first用途?

oujiachao 2012-04-27 03:03:46
asp.net entity framework code first 在项目中常用吗??哪里有好的资料学习啊??
...全文
139 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
IT-Style 2012-04-27
  • 打赏
  • 举报
回复
再就是多表联合查询实现比较困难.
也就是复杂查询实现比较困难.
IT-Style 2012-04-27
  • 打赏
  • 举报
回复
我感觉不常用.反正我们不用

因为其性能比ADO.NET低.
oujiachao 2012-04-27
  • 打赏
  • 举报
回复
其实我明白,不就是把数据库映射到语言中来,只不过是想把问题全部搞懂啊!![Quote=引用 6 楼 的回复:]
CodeFirst 是Entity Framework这个ORM框架提供的一种开发方式。
与之方式相反是 DataBaseFirst。

从字面上理解不能看出CodeFirst是先有编码(也就是映射到数据表的模型实体类,以及DBContext),EF会按照你创建模型的规则来为你创建数据库,一切都在程序运行后自动完成,无需你手动创建数据库。

而DataBase与之相反,你必须得现有一个数……
[/Quote]
a157147899 2012-04-27
  • 打赏
  • 举报
回复
CodeFirst 是Entity Framework这个ORM框架提供的一种开发方式。
与之方式相反是 DataBaseFirst。

从字面上理解不能看出CodeFirst是先有编码(也就是映射到数据表的模型实体类,以及DBContext),EF会按照你创建模型的规则来为你创建数据库,一切都在程序运行后自动完成,无需你手动创建数据库。

而DataBase与之相反,你必须得现有一个数据库,然后根据数据库来生成你的数据模型,以及DBContext。

两者相比较来说,CodeFirst显得更为灵活,更受开发人员的欢迎。
DataBase最显而易见的缺陷就在于,当数据库结构有改动时,需要重新映射数据库。

而EF 4.3为CodeFirst提供了数据库迁移(DataBase Migration)的功能,
当程序中数据模型有改动时,EF会自动为你修改对应的数据库结构。

从楼主问题来看,可能还不了解ORM的机制,先去看看ORM的概念会有助于你理解。
threenewbee 2012-04-27
  • 打赏
  • 举报
回复
可以,但是这就好比买了汽车不开,找几个人抬着走一样。
oujiachao 2012-04-27
  • 打赏
  • 举报
回复
能否用dataset,sqldatareader去访问?[Quote=引用 3 楼 的回复:]
以前写的文章,你可以看下:http://topic.csdn.net/u/20110414/10/06526263-9e0d-491f-b963-7ae0afd1f7e4.html
[/Quote]
threenewbee 2012-04-27
  • 打赏
  • 举报
回复
以前写的文章,你可以看下:http://topic.csdn.net/u/20110414/10/06526263-9e0d-491f-b963-7ae0afd1f7e4.html
oujiachao 2012-04-27
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 的回复:]
msdn.microsoft.com,里面有一个代码的栏目,里面有很多例子。
codefirst一般用来快速构建原型。
[/Quote]
能不能说具体怎么应用啊?????
threenewbee 2012-04-27
  • 打赏
  • 举报
回复
msdn.microsoft.com,里面有一个代码的栏目,里面有很多例子。
codefirst一般用来快速构建原型。
ASP.NET MVC with Entity Framework and CSS by Lee Naylor 2016 | ISBN: 1484221362 | English | 608 pages | True PDF | 30 MB This book will teach readers how to build and deploy a fully working example retail website using Microsoft ASP.NET MVC and Entity Framework technologies and recommendations. This book contains several solutions to real world issues that developers will frequently encounter. Whether you are a novice developer or an experienced .NET developer wishing to learn more about MVC and Entity Framework, author Lee Naylor will teach you how to develop a detailed database driven example website using Microsoft ASP.NET and Entity Framework Code First with fully explained code examples including: • Filtering and Searching Related Data using Linq • Using code first migrations to automatically update the database plus seeding data from code • How to use Visual Studio Scaffolding views and controllers • Manage CRUD operations including model binding as recommended by Microsoft and dealing with cascading deletions correctly • Input and data validation using Attributes • Sorting and paging through data and routing for friendly URL formats • Authorization and Authentication using Microsoft Identity v2 by making use of Microsoft example code including correct use of redirection after login and registration • Advanced techniques including managing data concurrency conflicts and using two database contexts • Asynchronous database access and paging • Azure deployment using Code First Migrations, remote debugging and viewing/editing your remote data • CSS Styling including animation and media queries What You Will Learn: • Get up and running quickly with ASP.NET MVC and Entity Framework building a complex web site to display and manage several related entities • How to integrate Identity code into a project • Advanced topics including: Asynchronous database access and managing data conflicts • Working with Microsoft Azure including remote debugging and database access • CSS skills including animations and media queries for use with tablet or mobile/cell phone devices Who This Book Is For: People wanting to learn ASP.NET MVC and Entity Framework ranging from novice developers new to the subject through to more experienced ASP.NET web forms developers looking to migrate from web forms to MVC and Entity Framework. The book assumes some programming knowledge such as object-oriented programming concepts and a basic knowledge of C#.

62,268

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧