asp vnext is comming

51
una consultora tecnológica que piensa en colores para organizaciones vivas una consultora tecnológica que piensa en colores para organizaciones vivas ASP. NET vNext is Coming !! Adrián Díaz Cervera

Upload: adrian-diaz-cervera

Post on 15-Apr-2017

411 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Asp vNext Is Comming

una consultora tecnológica que piensa en colores para organizaciones vivas

una consultora tecnológica que piensa en colores para organizaciones vivas

ASP. NET vNext is Coming !! Adrián Díaz Cervera

Page 2: Asp vNext Is Comming

Adrián Díaz Cervera

ENCAMINA

Email : [email protected] : AdrianDiaz81Blog blogs.encamina.com/desarrollandososharepoint/geeks.ms/blogs/adiazcervera

Es Microsoft Value Profesional de SharePoint Server desde 2014. Miembro de varias comunidades técnicas como SUGES, Office 365 y Valencia NET. Lleva desarrollando con tecnologías Microsoft más de 10 años y desde hace 5 años está centrado en el desarrollo software. Actualmente trabaja en el departamento de desarrollo de ENCAMINA una consultora informática de Valencia que se destaca por realizar soluciones basadas en Tecnología Microsoft, principalmente en SharePoint, SharePoint, Office 365 y Azure.

Page 3: Asp vNext Is Comming

Valencia.NET • Url: http://www.vlcdev.net/ • GitHub : https://github.com/ValenciaDEV • Linkedin: https://www.linkedin.com/grp/home?gid=3918814 • Twitter: @VLCDev

• Proximos Eventos– Octubre -> Helo Win10!! – Noviembre -> IOT, RaspBerryPi 2 y mucho más …. – Diciembre -> Desarrollo Movil Multiplataforma

Page 4: Asp vNext Is Comming

Agenda• Novedades– Novedades en C# – Roslyn– ASP .NET vNext ¿Qué és? • Cambios • Front End (Grunt, Gulp, Node, NPM)• Multiplataforma• C# 6,0• .NET Core

Page 5: Asp vNext Is Comming
Page 6: Asp vNext Is Comming

Novedades en C# 6.0

Page 7: Asp vNext Is Comming

La evolución del lenguaje

Page 8: Asp vNext Is Comming

• No hay grandes cambios como en otras versiones

• Algunas características pequeñas

• Clean Code

Principales cambios

Page 9: Asp vNext Is Comming

Getter-only auto-properties

public class Point{ public int X { get; set; } public int Y { get; set; } 

public Point(int x, int y) { X = x; Y = y; }

public double Dist { get { return Math.Sqrt(X * X + Y * Y); } }

public override string ToString() { return String.Format("({0}, {1})", X, Y); }}

Page 10: Asp vNext Is Comming

Getter-only auto-properties

public class Point{ public int X { get; } public int Y { get; }

public Point(int x, int y) { X = x; Y = y; }

public double Dist { get { return Math.Sqrt(X * X + Y * Y); } }

public override string ToString() { return String.Format("({0}, {1})", X, Y); }}

Page 11: Asp vNext Is Comming

Initializers for auto-properties

public class Point{ public int X { get; } = 5; public int Y { get; } = 7;

public Point(int x, int y) { X = x; Y = y; }

public double Dist { get { return Math.Sqrt(X * X + Y * Y); } }

public override string ToString() { return String.Format("({0}, {1})", X, Y); }}

Page 12: Asp vNext Is Comming

Using static classesusing System.Math;

public class Point{ public int X { get; } public int Y { get; }

public Point(int x, int y) { X = x; Y = y; }

public double Dist { get { return Math.Sqrt(X * X + Y * Y); } }

public override string ToString() { return String.Format("({0}, {1})", X, Y); }}

Page 13: Asp vNext Is Comming

Using static classesUsing static System.Math;

public class Point{ public int X { get; } public int Y { get; }

public Point(int x, int y) { X = x; Y = y; }

public double Dist { get { return Sqrt(X * X + Y * Y); } }

public override string ToString() { return String.Format("({0}, {1})", X, Y); }}

Page 14: Asp vNext Is Comming

String interpolationusing System.Math;

public class Point{ public int X { get; } public int Y { get; }

public Point(int x, int y) { X = x; Y = y; }

public double Dist { get { return Sqrt(X * X + Y * Y); } }

public override string ToString() { return String.Format("({0}, {1})", X, Y); }}

Page 15: Asp vNext Is Comming

String interpolationusing System.Math;

public class Point{ public int X { get; } public int Y { get; }

public Point(int x, int y) { X = x; Y = y; }

public double Dist { get { return Sqrt(X * X + Y * Y); } }

public override string ToString() { return $"(\{X}, \{Y})"; }}

Page 16: Asp vNext Is Comming

Expression-bodied methodsusing System.Math;

public class Point{ public int X { get; } public int Y { get; }

public Point(int x, int y) { X = x; Y = y; }

public double Dist { get { return Sqrt(X * X + Y * Y); } }

public override string ToString() { return $"(\{X}, \{Y})"; }}

Page 17: Asp vNext Is Comming

Expression-bodied methodsusing System.Math;

public class Point{ public int X { get; } public int Y { get; }

public Point(int x, int y) { X = x; Y = y; }

public double Dist { get { return Sqrt(X * X + Y * Y); } }

public override string ToString() { return $"(\{X}, \{Y})"; }}

() => { return $"(\{X}, \{Y})"; }

() => $"(\{X}, \{Y})"

Page 18: Asp vNext Is Comming

Expression-bodied methodsusing System.Math;

public class Point{ public int X { get; } public int Y { get; }

public Point(int x, int y) { X = x; Y = y; }

public double Dist { get { return Sqrt(X * X + Y * Y); } }

public override string ToString() => "(\{X}, \{Y})";}

Page 19: Asp vNext Is Comming

Expression-bodied propertiesusing System.Math;

public class Point{ public int X { get; } public int Y { get; }

public Point(int x, int y) { X = x; Y = y; }

public double Dist { get { return Sqrt(X * X + Y * Y); } }

public override string ToString() => "(\{X}, \{Y})";}

Page 20: Asp vNext Is Comming

Expression-bodied propertiesusing System.Math;

public class Point{ public int X { get; } public int Y { get; }

public Point(int x, int y) { X = x; Y = y; }

public double Dist => Sqrt(X * X + Y * Y);

public override string ToString() => "(\{X}, \{Y})";}

Page 21: Asp vNext Is Comming

Expression-bodied propertiesusing System.Math;

public class Point{ public int X { get; } public int Y { get; }

public Point(int x, int y) { X = x; Y = y; }

public double Dist => Sqrt(X * X + Y * Y);

public override string ToString() => "(\{X}, \{Y})";}

Page 22: Asp vNext Is Comming

Index initializerspublic class Point{ public int X { get; } public int Y { get; }

public JObject ToJson() { var result = new JObject(); result["x"] = X; result["y"] = Y; return result; }}

Page 23: Asp vNext Is Comming

Index initializerspublic class Point{ public int X { get; } public int Y { get; }

public JObject ToJson() { var result = new JObject() { ["x"] = X, ["y"] = Y }; return result; }}

Page 24: Asp vNext Is Comming

Index initializerspublic class Point{ public int X { get; } public int Y { get; }

public JObject ToJson() { return new JObject() { ["x"] = X, ["y"] = Y }; }}

Page 25: Asp vNext Is Comming

Index initializerspublic class Point{ public int X { get; } public int Y { get; }

public JObject ToJson() => new JObject() { ["x"] = X, ["y"] = Y };}

Page 26: Asp vNext Is Comming

Null-conditional operatorspublic static Point FromJson(JObject json){ if (json != null && json["x"] != null && json["x"].Type == JTokenType.Integer && json["y"] != null && json["y"].Type == JTokenType.Integer) { return new Point((int)json["x"], (int)json["y"]); } 

return null;}

Page 27: Asp vNext Is Comming

Null-conditional operatorspublic static Point FromJson(JObject json){ if (json != null && json["x"]?.Type == JTokenType.Integer && json["y"]?.Type == JTokenType.Integer) { return new Point((int)json["x"], (int)json["y"]); } 

return null;}

Page 28: Asp vNext Is Comming

Null-conditional operatorspublic static Point FromJson(JObject json){ if (json != null && json["x"]?.Type == JTokenType.Integer && json["y"]?.Type == JTokenType.Integer) { return new Point((int)json["x"], (int)json["y"]); } 

return null;}

?.

Page 29: Asp vNext Is Comming

Null-conditional operatorspublic static Point FromJson(JObject json){ if (json != null && json["x"]?.Type == JTokenType.Integer && json["y"]?.Type == JTokenType.Integer) { return new Point((int)json["x"], (int)json["y"]); } 

return null;}

Page 30: Asp vNext Is Comming

Null-conditional operatorspublic static Point FromJson(JObject json){ if (json?["x"]?.Type == JTokenType.Integer && json?["y"]?.Type == JTokenType.Integer) { return new Point((int)json["x"], (int)json["y"]); } 

return null;}

Page 31: Asp vNext Is Comming

Null-conditional operators

{ var onChanged = OnChanged; if (onChanged != null) { onChanged(this, args); }}

Page 32: Asp vNext Is Comming

Null-conditional operators

OnChanged?.Invoke(this, args);

Page 33: Asp vNext Is Comming

The nameof operator

public Point Add(Point point){ if (point == null) { throw new ArgumentNullException("point"); }}

Page 34: Asp vNext Is Comming

The nameof operator

public Point Add(Point other){ if (other == null) { throw new ArgumentNullException("point"); }}

Page 35: Asp vNext Is Comming

The nameof operator

public Point Add(Point point){ if (point == null) { throw new ArgumentNullException(nameof(point)); }}

Page 36: Asp vNext Is Comming

The nameof operator

public Point Add(Point other){ if (other == null) { throw new ArgumentNullException(nameof(other)); }}

Page 37: Asp vNext Is Comming

Exception filters

try{ … }catch (ConfigurationException e) if (e.IsSevere){ }finally{ }

Page 38: Asp vNext Is Comming

Await in catch and finally

try{ … }catch (ConfigurationException e) if (e.IsSevere){ await LogAsync(e);}finally{ await CloseAsync();}

Page 39: Asp vNext Is Comming

ROSLYN

• Compilador de  C# y  Visual Basic .NET 

• APIs para analizar el código y ayudar a refactorizarlo

• Open Source• Adaptar el código a

nosotros• Multiplataforma

Page 40: Asp vNext Is Comming
Page 41: Asp vNext Is Comming

41

Page 42: Asp vNext Is Comming

• Reescritura total de de ASP .NET• Incompatible a nivel de código con versiones

anteriores• MVC y Web API se unifican en una sola API “ASP NET

MVC 6”• WebForms queda Fuera• Open Souce • Entity Framework 7 se incluye “dentro” de ASP NET

ASP .NET vNext

42

Page 43: Asp vNext Is Comming

• Un CLR optimo para “CLOUD”ÞMenos pasadoÞaplicaciones escalablesÞNo vinculado a IIS

• Desplegable mediante Nuget

ASP .NET vNext

43

Page 44: Asp vNext Is Comming

• Fichero propio de vNext• Contiene:– Las referencias Nuget– Configuración– Frameworks sobre los

cuales puede correr la aplicación (.NET Fwk, K runtime, Mono,...)

Novedades: Project.json

44

Page 45: Asp vNext Is Comming

• Web.Config ha muerto• Nuevo framework de configuración con soporte para

json, command line, xml• Configuración”hardcoded” en código... –Bienvenido a un mundo gobernado por Roslyn–Modifica el código... Y refresca el browser

Novedades: Configuración

45

Page 46: Asp vNext Is Comming

Novedades: Configuración

46

Page 47: Asp vNext Is Comming

• Clase ServiceCollection se agregan todas las dependencias

• ¿que pasa con nuestros viejos y conocidos contenedores de dependencias, ya no son necesarios?

– crear nuestra propia implementacion de IServiceProvider

Novedades: Start Up -> Inyección de dependencias

47

Page 48: Asp vNext Is Comming

• Sustituyen a PartialView• Una clase que puede ser creada:–Heredando de ViewComponent.–Decorándola con el atributo [ViewComponent] –Que nuestra clase termine con el

sufijo ViewComponent.• Una vista que será renderizada por el método Invoke de

nuestro ViewComponent.

Novedades: ViewComponents

48

Page 49: Asp vNext Is Comming

• La nueva versión del ORM de MS se incluye dentro de ASP.NET vNext

• Totalmente reescrito desde cero• Incompatible con las versiones anteriores• Basado en code first y migrations

Entity FrameWork 7.0

49

Page 50: Asp vNext Is Comming

Novedades: Client Server

50

• es una librería JavaScript• Configurar tareas automáticas

Þahorrarnos tiempo en :Þnuestro desarrollo Þ despliegue de aplicaciones web

• Alguna de las tareas:– preprocesar stylus y convertirlo a CSS,– minificar el CSS– Validar Javascript–Minificar los ficheros JavaScript

Page 51: Asp vNext Is Comming

• Igual que Nuget pero solo para la web• NPM ?= Bower – NPM para modulos– Bower Librerias

• Evita conflicto de librerias• Estándar web

Novedades: Client Server Bower

51