ASP.NET 應用程式開發與設計 : Introduction to Web Application and Single-Page Application Model 講 師:李建祥 日 期: 2015/3/6 1

Embed Size (px)

DESCRIPTION

Agenda 3 Web Application 課程內容簡介 MVC Pattern Single-Page Application MVVM Pattern

Citation preview

ASP.NET : Introduction to Web Application and Single-Page Application Model 2015/3/6 1 Web Application Single-Page Application Web Application 2 Agenda 3 Web Application MVC Pattern Single-Page Application MVVM Pattern WEB APPLICATION 4 Web Application 5 EC 6 7 Browser Web server DB server http request http response SQL Data GET /customer?name=Chang HTTP/1.1 Host:Content-Type: text/html; charset=utf-8 select name, address from customers where name like %Chang% HTTP/ OK Content-Type: text/html;charset=UTF-8 Mary Chang Kaohsiung 8 Browser Web server DB server http request http response SQL Data HTML, CSS, JavaScript ADO.NET ASP.NET, C# Web Application Client (Scanner, printer ) 9 10 11 IoC IoC: Inversion of Control The flow of program is controlled by software framework, and the framework call your customized methods. Dependency Injection 12 IoC in Spring Main() Application Context (IoC Container) create MovieListner beans. xml load SimpleMovie Finder Bean Configuration File Client Code 13 ADOTemplate public class RowMapperDao : AdoDaoSupport { private string cmdText = Select CateogryID, CategoryName From Categories"; public virtual IList GetCategories() { return AdoTemplate.QueryWithRowMapper( CommandType.Text, cmdText, new CategoryRowMapper ()); } public class CategoryRowMapper : IRowMapper where T : Category, new() { public T MapRow(IDataReader dataReader, int rowNum) { T category = new T(); category.CateogryID = dataReader.GetString(0); category.CategoryName = dataReader.GetString(1); } categories = RowMapperDao.GetCategories(); foreach (Cateogry category in categories) { Console.Writeline({0}\t{1}, category.CategoryID, category.CategoryName); ) 14 15 Web Services a software system designed to support interoperable machine-to-machine interaction over a network W3C 16 $.getJSON(http://w ww.service.com/cust omer/0001, function(data) {}); GET{name:Mary, address:Kaohsiung} 17 15% 35 % 50% 18 WEB APPLICATION 19 Model View Controller (MVC) Pattern Model domain model and business logic View displays the model Controller receives user input and updates the model 20 https://msdn.microsoft.com/en-us/magazine/dn aspx MVC 21 Model LoginUser Question, Option LoginUser +Name +Password Question +Id +Title Option +OptionId +Title +IsCorrect 1 * 22 View Web pages 23 Controller 24 Controller Single-Page Application Web application Single-Page Application Web application JavaScript, HTML5, CSS Web service 25 Web Application vs SPA 26 https://msdn.microsoft.com/en-us/magazine/dn aspx SPA 27 URL: Model View ViewModel (MVVM)Pattern Model domain model and business logic View Model is an abstract representation of the view the view model is coupled only to one view View displays the view model and sends user input to the view model 28 https://msdn.microsoft.com/en-us/magazine/dn aspx View 29 ViewModel 30 Web Application 31 Pro Single Page Application Development: Using Backbone.js and ASP.NET SPA 32 Pro Single Page Application Development: Using Backbone.js and ASP.NET 33 NUnit: ADO.NET: https://msdn.microsoft.com/zh- tw/library/e80y5yhx%28v=vs.110%29.aspxhttps://msdn.microsoft.com/zh- tw/library/e80y5yhx%28v=vs.110%29.aspx Web API: https://msdn.microsoft.com/zh- tw/library/hh833994%28v=vs.108%29.aspxhttps://msdn.microsoft.com/zh- tw/library/hh833994%28v=vs.108%29.aspx Spring.NET: NPOI library: https://npoi.codeplex.com/https://npoi.codeplex.com/ Kendo UI:34 Q&A