asp.net mvc


1          
概要
全体紹介
:http://www.asp.net/mvc/tutorials/overview/asp-net-mvc-overview
ファイル
:http://msdn.microsoft.com/en-us/library/dd410120(VVS.98).aspx
asp.net mvc_第1张图片

Models
Model objectsarar the parts of the ap plication that implement the logic for the appplicatis datadoman.Ofnen、model ojecs retrieve and storore model state in a database.For exple、a Prodexample、a PrProductobaject oobaject Proooooooooojectititititititititititititttttttttttforforforforfore、a ProoooojectrtrtrtrtrtrinininininininininininininininininstststststL Server.

:
モデル
dataとの違いと連絡。
Ø 
Business logic belongs in the model.
Ø 
 
 

View
..
Views are the components that display the appration s user interface(UI).Typeically,this UI is created from the model data.An example would be and view of Prods table display s text,dows drect。

Controller
Controllers are the components that handle user interaction、work with the model、and ultimartely select a view to render that displays UI、In an MVC appration、the view onlydisplays information。the controller handles and reponds to user input and interaction.For example,the controller handles query-string values,and passs the the the model,which in turn queries the database by using the values.
MVC
利点:
The MVC pattern helps you create aplications that separate the different aspects of the appication(input logic、busines logic、and UI logic)、while providing a loose coupling between these elemens.The pattern specifies where each kind of logic shound be located in the appination.The UI logic belongs the view.Input logic belongs belongs the contrologless.Bultions。because it enables you to focus on one aspect of the implement ation at a time.For example,you can focus on the view without depending on the busines logic.
 
MVC
実行サイクル
:
参照
:http://msdn.microsoft.com/en-us/library/dd381612(v=vs.98).aspx
ステージ
Details
Receive first request for the appration
In the Global.asax file,Route object are added to the RouteTable Object.
Perform routing
The UrlRoutingModule module uses the first matching Route Object in the RouteTable collection to create the RouteData oject,which it then uses to create a Request Context oject.
Create MVC request handler
The MvcRouteHandler object creates an instance of the MvcHandler class and passes the Request Controtext instance to the handler.
Create controller
The MvcHandler object uses the Request Context instance to identify the IController Factory oject(typicalle an instance of the Default Controller Factory class)to create the controller instance with.
Execute controller
The MvcHandler instance call ls the controller's Execute method.
Invoke action
For controllers that inher it from the Controller Base class,the Controller Action Invoker object that is ast crated with the control determines which action method of the control clast call,and then cars cars methat.
Execute result
The action method receives user input、prepares the aap proprinate reponse data、and then eexecutes the rereturning a returning a reult type.The built-inreret t t t t t typet t t t t can eeeeeeeeexuted incled includedededededededededed includededededededededededededededededededededededededededededededededededededededededededededededederererererererererererererererererereeeeeeeeeeeコンテントリセット、Json Resoult、FileResult,and EmptyResult.
 
 Language Integrated Query(LINQ)
参考:http://social.msdn.microsoft.com/search/en-us?query=LINQ&x=0&y=0
 
class Query VMethodSyntax
{
static
void Main()
{
int[]numbers={5,10,8,3,6,12}
//Query syntax:
IEnumerable<
int>numQuery 1=
from num
インumbers
where num%2==0
ordeby num
select num;
//Method syntax:
IEnumerable<
int>numQuery 2=numbers.Where(num=>num%2==0).OrderBy(n=>n)
foreach(
int i
in numQuery 1)
{
Consone.Write(i+
「」
)
Consone.WriteLine(System.Environment.NewLine);
foreach(
int i
in numQuery 2)
{
Consone.Write(i+
「」
)
//Keep the consolie open in debug mode.
Consone.WriteLine(System.Environment.NewLine);
Consone.WriteLine(
「Press any key to exit」);
Consone.ReadKey()
)
)
Lamda Expressions    
http://msdn.microsoft.com/enus/library/bb397687.aspx 
http://www.cnblogs.com/JeffreyZhao/archive/2009/08/07/from-delegate-to-others-2.html
Note in the previous eexample that the body of an expressisisisisision lambadacan consist of a methodcal.However,iiyou ararare creatiting expressisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisisiststststststststs.Hoaaaaaaae.HoT common lagge runtime.
Linq to  Sql   http://msdn.microsoft.com/en-us/library/bb399398.aspx
 
   
   
   
   
  1.  
  2. // Northwnd inherits from System.Data.Linq.DataContext.  
  3. Northwnd nw = new Northwnd(@"northwnd.mdf");  
  4. // or, if you are not using SQL Server Express  
  5. // Northwnd nw = new Northwnd("Database=Northwind;Server=server_name;Integrated Security=SSPI");  
  6.  
  7. var companyNameQuery =  
  8.     from cust in nw.Customers  
  9.     where cust.City == "London" 
  10.     select cust.CompanyName;  
  11.  
  12. foreach (var customer in companyNameQuery)  
  13. {  
  14.     Console.WriteLine(customer);  
 
Linq to Entties   http://msdn.microsoft.com/en-us/library/bb399367.aspx
         
Query Expression Syntax Examples:Projection
Query Expression Syntax Examples:Filtering
Query Expression Syntax Examples:Ordering
Query Expression Syntax Examples:Agregate Operators
Query Expression Syntax Examples:Partioning
Query Expression Syntax Examples:Join Operators
Query Expression Syntax Examples:Element Operators
Query Expression Syntax Examples:Grouping
Query Expression Syntax Examples:Navigating Relations 
ビデオを紹介する
:
http://www.pluralsight-training.net/microsoft/players/PSODPlayer?author=scott-allen&name=mvc 3-building-inntro&mode=live&clip=0&course=aspdotnet-mvc 3-intro
 
まとめ: