Difference between MVC and business logic (3 levels)

I am trying to find the difference between MVC and three-tier architecture in ASP.NET. I mentioned some previous previous questions and some pages, but I could find a clear answer.
Here is the msdn page about MVC implementation: http://msdn.microsoft.com/en-us/library/ff647462.aspx

Think I want this code:
Single aspx url and code

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
   <head>
      <title>start</title>
      <script language="c#" runat="server">
         void Page_Load(object sender, System.EventArgs e)
         {
            String selectCmd = "select * from Recording";

            SqlConnection myConnection = 
               new SqlConnection(
                  "server=(local);database=recordings;Trusted_Connection=yes");
            SqlDataAdapter myCommand = new SqlDataAdapter(selectCmd, 
               myConnection);

            DataSet ds = new DataSet();
            myCommand.Fill(ds, "Recording");

            recordingSelect.DataSource = ds;
            recordingSelect.DataTextField = "title";
            recordingSelect.DataValueField = "id";
            recordingSelect.DataBind();
         }
       </script>
   </head>
   <body>
         <asp:dropdownlist id="recordingSelect" runat="server" />
         <asp:button runat="server" text="Submit" OnClick="SubmitBtn_Click" />
      </form>
   </body>
</html>

Now consider that I have different files for
---- View and code behind. ----
.aspx

<%@ Page language="c#" Codebehind="Solution.aspx.cs" 
   AutoEventWireup="false" Inherits="Solution" %>
<html>
         <asp:dropdownlist id="recordingSelect" runat="server" />
      </form>
   </body>
</html>

.aspx.cs

using System;
using System.Data;
using System.Data.SqlClient;
public class Solution : System.Web.UI.Page
{
   private void Page_Load(object sender, System.EventArgs e)
   {
      if(!IsPostBack)
      {
         String selectCmd = "select * from Recording";
         SqlConnection myConnection = 
            new SqlConnection(
               "server=(local);database=recordings;Trusted_Connection=yes");
         SqlDataAdapter myCommand = new SqlDataAdapter(selectCmd, myConnection);
         DataSet ds = new DataSet();
         myCommand.Fill(ds, "Recording");
         recordingSelect.DataSource = ds;
         recordingSelect.DataTextField = "title";
         recordingSelect.DataValueField = "id";
         recordingSelect.DataBind();
      }
   }
  • Having seen the msdn page link for the class above Controller, I cannot distinguish the difference between business logic (which were similar for the middle level in a three-tier architecture) and the controller.
  • 3- MVC ? ASP.NET Visual Studio , MVC? , ?
  • MVC, aspx .aspx.cs?
+5
3

myslef, , , , (///-):


  • Html/jQuery, Model,

  • , , View ( ..).
    • ( ..), -.
    • -
    • ,
  • -
    -, db .. , , MVC, , - MVC. ( ), , MVC .
    unit test -, MVC .

, - , , . MVC, , unit test .

, ASP.NET.
, - MVC - , (+ Busines).

, .

+5

MVC 3 - .
, , 3 .

MVC :
: html js ( -)
: UI (= ) back-end (= )
: ,

3- :
UI: html/js, .
, -.
-: , , , ,..
, . .
: , -.
, - , .

, , :
:
-:
:
: , (, ,..) .
.

, !

+2

/

MVC , () - . . , ASP.NET(Razor) .

The main difference, which will start to matter more if you want to check the logic in your controller automatically, is that the controller is just an old class, but your code inherits from System.Web.UI.Page and, therefore, is strongly tied to internal ASP.net versions.

Also read http://ardalis.com/Codebehind-Files-in-ASP.NET-MVC-are-Evil and also https://msmvps.com/blogs/luisabreu/archive/2008/09/19/codebehind -files-in-asp-net-mvc-are-not-evil.aspx

0
source

All Articles