Difference between Entity Framework and Microsoft SQL Server - asp.net

I'm fairly new to mvc, asp.net, and .net framework in general.
I understand what models are, controllers and views, but what I don't get it is Entity Framework. I developed websites before using php, and when I needed to store some data I simply do that using MySql databases. I thought this is the case with asp.net, same concept but instead of MySql, Microsoft Sql server is used. Now I started to learn .net framework and I watched a lot of online tutorials and saw them using some classes inherited from DbContext to store data! Can anyone tell me where these classes store the data and why don't we use Microsoft Sql server instead?

Entity Framework is an Object Relational Mapping tool (ORM), a layer that sits between your database and code. The idea is that the ORM is database agnostic and will handle writing the SQL for you, so that you could (in theory) swap between SQL Server, MySQL, or whatever database you want with only configuration changes.
You can skip Entity Framework and use SQL directly with ASP.Net. Your tutorials just happen to use Entity Framework.

Related

Access DB from C# using System.Data.Entity but NOT EF

My company has an older ASP site that looks like it's written using model-first EF pattern... Except there are no references to EntityFramework.dll anywhere. Talking to the original coder, it doesn't seem he actually knows how he got it to work. He though EF was in the System.Data.Entity namespace as it comes in the framework.
How is it that he was accessing a database (DB2) using models/entities but not actually referencing the EF anywhere ?
As the documentation from MSDN for System.Data.Entity:
The System.Data.Entity namespace contains classes that provides access
to the core functionality of the entity framework.
To access a database without Entity Framework, you can use ado.net. It is the first level of data access and you should learn it before using any ORM tool. Check the namespace System.Data.SqlClient to have types to access Sql Server database. If you check each type, you will see there is a common convention to implement a ado.net data access in .Net. WE have DbConnection, DbCommand, DbTransaciton, IDataReader, etc. All these common types you can see in System.Data.Common.
For the DB2 database, you can download the .Net Provider for data access with Db2 in this link because it is not native provider. It is the same way as you do for other database, but use the specific .Net Provider.
Turns out that EF 4 was initially released as part of .NET 4.0. Only since EF 4.1 was it separated into its own package.

Asp.net Web API With No Entity Framework

We want to start using Asp.net web api for our future enterprise services however we do not want to use EF for data access.
Are there any samples out there for Asp.net Web APi working with regular ado.net classes instead of EF?
Thanks.
Are you looking for code samples for how to use e.g., SqlConnection, SqlCommand, SqlDataReader?
You would use the classes in System.Data.SqlClient if you are trying to talk to SQL Server, System.Data.OracleClient if you're trying to talk to Oracle, or System.Data.Odbc if you're trying to talk to MySQL.
Here are some code samples for how to call a stored procedure from ADO.NET. Good luck!

Entity Framework Vs Data Access Layer

I want to know list of advantages of using Entity framework over data access layer.
My website is host in shared hosting and i don't have access to IIS
Considering that i am working shared hosting world, is it feasible to work with entity framework?
Microsoft has publicly stated that Entity Framework will be the preffered data access technology for the .NET platform. Given your experience I feel like Entity Framework would be a huge asset to your ability to rapidly develop applications. Shared hosting is completely irrelevant to the fact that you are using entity framework. Just make sure that the hosting company supports .Net 4 framework (or w/e framework version you work with).
Entity Framework is a data access layer. Specifically it's an Object Relational Mapper.
So it basically comes down to - do you want to write your own DAL? - or would you rather spend your time building out the Data Model, and then having Entity create your entities and classes, etc.. for you.

What parts of asp.net, c# and database should I use to create a forum like stackoverflow?

I am a fresher and I have got a project in asp.net and c#. I have to create a forum, something like stackoverflow, so I have studied asp.net, c# and sql server 2008 but now I am unsure how I should start work on this project.
What technology and what part of asp.net, c# and the database will I use more? I have 3 days to study so I want to know which parts of asp.net, database and c# I have to cover in 3 days.
It's my first live project, will I have to study any other languages or are the ones listed enough?
Session management, good understanding about web controls and user control.
and just go throgh ado.net if u are using asp.net.
Maybe you should try to use ASP.net mvc check this link.
If you are going to use sql server as database / Backend of you application than
start getting infomation about linq to sql >>
LINQ to SQL: .NET Language-Integrated Query for Relational Data
or you can also go for entity framework
The ADO.NET Entity Framework Overview

SQLite from C# - Which is easier to LINQ-to-SQL or Entity Framework?

What would people recommend using as a persistence approach for Sqlite from a C# windows forms application - LINQ-to-SQL or Entity Framework?
(I ask this on the basis that I've had some people say stay away from DataTables and move to one of the new approaches)
LINQ-to-SQL is only available for SQL Server. That may limit your choices somewhat.
Apparently there's a project called DbLinq that tries to port the LINQ-to-SQL interfaces to other databases: http://code.google.com/p/dblinq2007/ . Haven't tried it myself.

Resources