asp vnext is comming

Post on 15-Apr-2017

412 Views

Category:

Software

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

Adrián Díaz Cervera

ENCAMINA

Email : addiacer@gmail.comTwitter : 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.

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

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

Novedades en C# 6.0

La evolución del lenguaje

• No hay grandes cambios como en otras versiones

• Algunas características pequeñas

• Clean Code

Principales cambios

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); }}

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); }}

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); }}

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); }}

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); }}

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); }}

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})"; }}

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})"; }}

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})"

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})";}

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})";}

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})";}

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})";}

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; }}

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; }}

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

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

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

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

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;}

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;}

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;}

?.

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;}

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;}

Null-conditional operators

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

Null-conditional operators

OnChanged?.Invoke(this, args);

The nameof operator

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

The nameof operator

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

The nameof operator

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

The nameof operator

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

Exception filters

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

Await in catch and finally

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

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

41

• 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

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

• Desplegable mediante Nuget

ASP .NET vNext

43

• 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

• 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

Novedades: Configuración

46

• 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

• 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

• 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

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

• 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

top related