SQL Server, ASP.NET MVC and Entity Framework... None of these frameworks depend on other framework. They are used with each other just to provide more features and functionality. For example if I am going to create a website where I do not need data or forms being submitted, I can create it using ASP.NET MVC without adding any data controllers for SQL Server or Entity Framework.
Connections to SQL Server are made using the objects provided under
System.Data.SqlClient
[
^] namespace. It provides you with connection object, parameters (
for prevention from SQL Injection), commands and other required stuff. You can use them to connect. For example,
using (var connection = new SqlConnection("data-connection-string")) {
connection.Open();
var command = new SqlCommand("YOUR SQL COMMAND", connection);
}
There is no need for ASP.NET MVC or Entity Framework at all just to establish the connection to SQL Server. The things that you need for SQL Server are:
1. A valid SQL Server.
- This is what responds to your request.
2. A connection string that represents method of connections.
- Server name
- Database name (optional, can be changed later)
- Credentials or authentication type.
These would allow you to connect. However, I also have an article for connecting to a database using C# only (
no ASP.NET MVC or Entity Framework dependency).
How to connect SQL Database to your C# program, beginner's tutorial[
^]