如何连接SQL数据库在Asp.net MVC3初学者水平初学者、水平、数据库、SQL

2023-09-03 22:31:12 作者:扯淡的爱越扯越淡

我用来开发在ASP.Net应用程序,在这种情况下,我们可以使用ADO.net和连接字符串,也$隐藏文件C $℃。 但这里MVC是很好的方式分离BUSSINES逻辑。所以我学习贯彻架构。

i used to develop application in ASP.Net, in that case we can use ADO.net and connection strings, and also code behind files. but here MVC is nice way to separate the bussines logic. so i'm learning to implement the architecture.

我在做一个示例应用程序,其中有问题和答案都存储在数据库(SQL Server 2008),它像Stackoverflow.com一样,因为我是初学者在Asp.net MVC 3,我不是能够在应用程序连接数据库。

I'm making a sample application, in which were Questions and Answers are stored in database (Sql Server 2008), its same as like Stackoverflow.com, as i am beginner in Asp.net MVC 3, i'm not able to connect the Database within Application.

我来了防空火炮模型的概念使用ORM(LINQ到SQL),但我很beginer我不能够得到所有的想法。我想要做的CRUD操作数据库,使用MVC 3,

I came accross the MOdel concept by using ORM ( Linq to Sql ), but as i am beginer i'm not able to get the all ideas. i want to do CRUD operation with the database, Using MVC 3,

和我也都知道有辅助方法CRUD操作,但我真不知道如何实现与数据库。 帮助我如何插入,更新,编辑,数据库中的数据删除

and also i come to know there is helper methods for CRUD operation, but i really don know how to implement with database. Help me how to Insert, Update, Edit, Delete Data in Database

推荐答案

在回答你的问题非常广泛。有很多的技术,建筑师如何获得方面你的应用程序/数据集和关注如何正确区分开来。 但开始的时候,请理解这一基本事实:MVC是对的网站的一个平台开发,并有无关的数据访问。 MVC为您提供的基础设施构建Web应用程序的一个非常有效和直接的方式(相对于旧的WebForms平台)。但是,当它到达的数据,MVC的M的意思是模式,其中折叠后面的选项无限范围内获取数据。 这是最好真正做到在单独的程序集(甚至不使用由新的MVC应用程序的Visual Studio模板中的一个项目自动创建的模型文件夹)。

The answer to your question is very broad. There are a lot of techniques to architect your application in terms of how to get/set data and how to correctly separate concerns. But for the beginning, please understand the basic fact that MVC is a platform for web development and has nothing to do with data access. MVC provides you the infrastructure to build web application in a very efficient and straightforward way (relative to the old WebForms platform). But when it gets to data, the 'M' of MVC means 'Model', which folds behind it an infinite range of options to get to the data. It's best to actually do that in separate assemblies (and even not use the Model folder created automatically in a project by the New MVC Application visual studio template).

有一个伟大的书开始学习MVC的,其中包括一些重要的架构方面怎么样来访问数据库,以及如何组件化的体系结构,并保持它维护的。

There is a great book to start learning MVC from, which covers some important architectural aspects like how to access the database and how to "componentize" your architecture and keep it maintainable.

这是本书: HTTP://www.a$p$pss.com/9781430234043 请注意,源$ C ​​$ C /下载选项卡,你可以下载完整的演示项目ZIP,你可以借鉴。

This is the book: http://www.apress.com/9781430234043 Please note that under 'Source code/Downloads' tab you can download a ZIP with complete demo projects you can learn from.

祝你好运!

 
精彩推荐
图片推荐