[#ENTLIB] Enterprise Library 6 is here!


image

Buenas,

a new Major Version of Enterprise Library was released a few days ago, in this case the version 6. Within it we find the following:

  • New block
  • New programmatic configuration
  • Updated 7 blocks:
    • Data Access Application Block
    • Exception Handling Application Block
    • Logging Application Block
    • Policy Injection Application Block
    • Transient Fault Handling Application Block
    • Validation Application Block
    • Unity Application Block / DI Container (v3.0)
  • Configuration console (largely unchanged since v5)

If it is possible to access the source code of EntLib directly from CodePlex , the ideal to use EntLib blocks is to add them using NuGet .

image

With this said, according to the great Grigori Melnik , the links below are the points of reference for this version:

Source: http://blogs.msdn.com/b/agile/archive/2013/04/25/just-released-microsoft-enterprise-library-6.aspx

Saludos @ Home

El Bruno

image image image

[#ENTLIB] Enterprise Library 6 is here !!!


image

Buenas,

una nueva Major Version de Enterprise Library se ha liberado hace unos días, en este caso la versión 6. Dentro de la misma podemos encontrar lo siguiente:

  • New block
  • New programmatic configuration
  • Updated 7 blocks:
    • Data Access Application Block
    • Exception Handling Application Block
    • Logging Application Block
    • Policy Injection Application Block
    • Transient Fault Handling Application Block
    • Validation Application Block
    • Unity Application Block/DI Container (v3.0)
  • Configuration console (largely unchanged since v5)

Si bien es posible acceder al source code de EntLib directamente desde CodePlex, lo ideal para usar los bloques de EntLib es agregar los mismos utilizando NuGet.

image

Con esto dicho, según el gran Grigori Melnik, los siguientes links son los puntos de referencia para esta version:

 

Fuente: http://blogs.msdn.com/b/agile/archive/2013/04/25/just-released-microsoft-enterprise-library-6.aspx

Saludos @ Home

El Bruno

image image image

[# RESHARPER] AgentMulder: excellent AddIn to work with IoC


Buenas,

yesterday I commented on the availability of Unity for .net 4.5 and also made a comment on Agent Mulder . Agent Mulder is an awesome extension for ReSharper that allows you to navigate to a specific type declarations and implementations when we are working with some dependency injection container.

How to explain it in words I’m not well today, better go to an example. Suppose that we are working with Unity and have a with the following example console application:

   1: using System;
   2: using System.Diagnostics;
   3: using Microsoft.Practices.Unity;
   4:  
   5: namespace ConsoleApplication1
   6: {
   7:     class Program
   8:     {
   9:         static void Main(string[] args)
  10:         {
  11:             var container = new UnityContainer();
  12:             container.RegisterType<ILogger, LogDebug>();
  13:             var log = container.Resolve<ILogger>();
  14:             log.Log("sample data");
  15:             Console.ReadLine();
  16:         }
  17:     }
  18:     internal interface ILogger
  19:     {
  20:         void Log(string data);
  21:     }
  22:     class LogTrace: ILogger
  23:     {
  24:         public void Log(string data)
  25:         {
  26:             Trace.WriteLine(data);
  27:         }
  28:     }
  29:     class LogDebug : ILogger
  30:     {
  31:         public void Log(string data)
  32:         {
  33:             Debug.WriteLine(data);
  34:         }
  35:     }
  36: }

In the Visual Studio IDE, trying to see where the LogDebug class has been used is a bit craftsmanship, having no direct references, because it is a little complicated to know where you are using. If we see the help online that we since we will see something similar to the following in the code editor

image

Now if you download and install Agent Mulder , this plugin from ReSharper will show us that the class LogDebug() is registering and using with Unity. We can access registration of the same line and even then accessing dynamic references of ReSharper to see where it is implemented and use the Log() function.

image

In a few words Agent Mulder helps us to navigate between the references that we do with a dependency injector, as Unity, CastleWindsor, etc. The official website of the product sample is mounted on CastleWindsor .

Download: http://hmemcpy.github.com/AgentMulder/

Saludos @ La Finca

El Bruno

image image image

[#RESHARPER] AgentMulder: excelente AddIn para trabajar con IoC


Buenas,

ayer comenté sobre la disponibilidad de Unity para .Net 4.5 y además hice un comenario sobre Agent Mulder. Agent Mulder es una extensión impresionante para ReSharper que nos permite navegar hacia las implementaciones y declaraciones de un tipo específico cuando estamos trabajando con algún contenedor de inyección de dependencias.

Como explicarlo en palabras no se me da bien hoy, mejor vamos a un ejemplo. Supongamos que estamos trabajando con Unity y tenemos una aplicación de consola con el siguiente ejemplo:

 

   1: using System;

   2: using System.Diagnostics;

   3: using Microsoft.Practices.Unity;

   4:  

   5: namespace ConsoleApplication1

   6: {

   7:     class Program

   8:     {

   9:         static void Main(string[] args)

  10:         {

  11:             var container = new UnityContainer();

  12:             container.RegisterType<ILogger, LogDebug>();

  13:             var log = container.Resolve<ILogger>();

  14:             log.Log("sample data");

  15:             Console.ReadLine();

  16:         }

  17:     }

  18:     internal interface ILogger

  19:     {

  20:         void Log(string data);

  21:     }

  22:     class LogTrace: ILogger

  23:     {

  24:         public void Log(string data)

  25:         {

  26:             Trace.WriteLine(data);

  27:         }

  28:     }

  29:     class LogDebug : ILogger

  30:     {

  31:         public void Log(string data)

  32:         {

  33:             Debug.WriteLine(data);

  34:         }

  35:     }

  36: }

En el IDE de Visual Studio, intentar ver donde se ha utilizado la clase LogDebug es un poco trabajo artesanal, ya que al no tener referencias directas, pues se complica un poco saber donde se está utilizando. Si vemos la ayuda online que tenemos en el editor de código pues veremos algo similar a lo siguiente

image

Ahora bien, si descargamos e instalamos Agent Mulder, este plugin de ReSharper nos mostrará que la clase LogDebug() se está registrando y utilizando con Unity. Podremos acceder a la línea de registro de la misma y luego inclusive, acceder a las referencias dinámicas de ReSharper para ver donde se implementa y utiliza la funcion Log().

image

En pocas palabras, Agent Mulder nos ayuda a navegar entre las referencias que realizamos con algún inyector de dependencias, como Unity, CastleWindsor, etc. El ejemplo de la página oficial del producto está montado sobre CastleWindsor.

Descarga: http://hmemcpy.github.com/AgentMulder/

Saludos @ La Finca

El Bruno

image image image

[#UNITY] Unity for .net Framework 4.5 and Windows RT available


image

Buenas,

If you’ve begun to bear strong in vein with developments for Windows 8 , you know that the new subset of .net Framework with which we have to work in Windows 8 , because it does not have all the features to which we are accustomed. We have things that we like a lot like async and await (though the Javi angry), but then Miss missing others like e.g. Unity.

As well, thanks Grigory M post , I see that we already have an Assembly to perform a bit of IoC inWindows 8 . Now these lines may already be part of our projects for Windows 8

   1: static void Main(string[] args)
   2: {
   3:     var container = new UnityContainer();
   4:     container.RegisterType<ILogger, LogDebug>();
   5: }

If we add that the great discovery of the plugIn for ReSharper Agent Mulder, because we already have the fine fine development environment to work.

By the way: If you don’t know Agent Mulder, in the morning post going to freak out!

Source: http://blogs.msdn.com/b/agile/archive/2012/08/10/unity-3-0-Preview-for-NET-Framework-4-5-and-winrt.aspx

Saludos @ La Finca

El Bruno

image image image

[#UNITY] Unity para .Net Framework 4.5 y Windows RT disponible!


image

Buenas,

si te has comenzado a dar fuerte en vena con desarrollos para Windows 8, sabrás que el nuevo subset de .Net Framework con el que tenemos que trabajar en Windows 8, pues no tiene todas las features a las que estamos acostumbrados. Tenemos cosas que nos gustan un monton como await y async (por más que el Javi se enfade), aunque luego echamos en falta otras como por ejemplo Unity.

Pues bien, gracias al post de Grigory M, veo que ya tenemos un ensamblado para poder realizar un poco de IoC en Windows 8. Ahora estas líneas ya pueden ser parte de nuestros proyectos para Windows 8

   1: static void Main(string[] args)

   2: {

   3:     var container = new UnityContainer();

   4:     container.RegisterType<ILogger, LogDebug>();

   5: }

 

Si ha eso le sumamos el gran descubrimiento del plugIn para ReSharper Agent Mulder, pues ya tenemos el entorno de desarrollo fino fino para comenzar a trabajar.

Por cierto: si no conoces Agent Mulder, en el post de mañana vas a flipar !!!!

Fuente: http://blogs.msdn.com/b/agile/archive/2012/08/10/unity-3-0-preview-for-net-framework-4-5-and-winrt.aspx

Saludos @ Home

El Bruno

image image image

[UNITY] Working with Singleton using # UNITY


image47dd1de4

Good,

a few days ago, Jorge wrote an article gutting the functioning of a Singleton with.NET. Then came Joseph and also did a bit of light on the matter; and I thought to myself,

But they that speak? programming a Singleton by hand, are crazy or what?

We are going to from Edu defined to UNITY that makes the news"because I believe that I have not created an object with"new"for quite some time. For those who do not know UNITY, because in a nutshell is a dependency injector created by the team of Patterns & Practices by Microsoft which is now in its 2.0 version and, to the dark beer, you’re liking when hold you you the taste.

We see a very, very simple example in which we will use a class called "ClaseChorra" to validate instances that are created the same.

The Singleton model is based on the simple example which explains Jorge in his post.

   1: class ClaseChorra
   2: {
   3:     private static ClaseChorra claseChorra;
   4:     public System.Guid Id { get; set; }
   5:     public ClaseChorra()
   6:     {
   7:         Id = System.Guid.NewGuid();
   8:     }
   9:     public override string ToString()
  10:     {
  11:         return Id.ToString();
  12:     }
  13:     public static ClaseChorra GetSingletonInstance()
  14:     {
  15:         return claseChorra ?? (claseChorra = new ClaseChorra());
  16:     }
  17: }

Before proceeding > > Disclaimer: is now in Spain Luernes (Monday + Friday) so either I am working much with examples, is what usually happens after a hard week of work.

Does not need to explain that if I think cholón objects, as explained Jorge in his post, because I have very mixed errors.

For example the following code let me a single instance with the same ID for each run of the same:

   1: class Program
   2: {
   3:     static void Main(string[] args)
   4:     {
   5:         var c1 = ClaseChorra.GetSingletonInstance();
   6:         var c2 = ClaseChorra.GetSingletonInstance();
   7:         c2.Id = Guid.NewGuid();
   8:         Console.WriteLine("c1: {0}", c1);
   9:         Console.WriteLine("c2: {0}", c2);
  10:         Console.ReadLine();
  11:     }
  12: }

The result is:

   1: c1: 34baaf27-87de-42f7-b2ad-046e35ee65fa
   2: c2: 34baaf27-87de-42f7-b2ad-046e35ee65fa

Well well, here the example of George. But how are we would with UNITY?. Ideally, read the article from MSDN "Using Lifetime Managers" where explains different options to work with record types and objects in Unity. I’ll leave a couple of examples.

For example, in the following piece of code, I’m defining a UnityContainer so that it is responsible for creating the objects I need for me (remember the words of the Edu > "UNITY is the news"). Using the container I think instances c1 and c2 and then show the same values.

   1: static void Main(string[] args)
   2: {
   3:     var myContainer = new UnityContainer();
   4:     myContainer.RegisterType<ClaseChorra>();
   5:     var c1 = myContainer.Resolve<ClaseChorra>();
   6:     var c2 = myContainer.Resolve<ClaseChorra>();
   7:     c2.Id = Guid.NewGuid();
   8:     Console.WriteLine("c1: {0}", c1);
   9:     Console.WriteLine("c2: {0}", c2);
  10:     Console.ReadLine();
  11: }

The result are 2 different of the same class instances:

   1: c1: dea932a8-7ce6-4f44-aa6c-89cb04bed186
   2: c2: 011f211a-9a83-463d-81ea-566ef0dbbdab

Now, if I wanted that long to create an object of type ClaseChorra, it is the same instance for all, because simply I tell UnityContainer LifeTimeManager type should be used. There are several options, but for the next example will use a PerThread, which helps us to have a single instance of the object by thread.

   1: static void Main(string[] args)
   2: {
   3:     var myContainer = new UnityContainer();
   4:     myContainer.RegisterType<ClaseChorra>(new PerThreadLifetimeManager());
   5:     var c1 = myContainer.Resolve<ClaseChorra>();
   6:     var c2 = myContainer.Resolve<ClaseChorra>();
   7:     c2.Id = Guid.NewGuid();
   8:     Console.WriteLine("c1: {0}", c1);
   9:     Console.WriteLine("c2: {0}", c2);
  10:     Console.ReadLine();
  11: }

As well you will be assuming, now the c1 and c2 classes are the same:

   1: c1: 84b8087b-48f5-4519-9362-b5239603ac0a
   2: c2: 84b8087b-48f5-4519-9362-b5239603ac0a

So now you know, or you get to encode all the Singleton pattern super sure in your code and leave that "UNITY makes the news por tí" Risa

Greetings @ Home

The Bruno

Sources:

[UNITY] Trabajando con Singleton utilizando #UNITY


image47dd1de4

Buenas,

hace unos días, Jorge escribió un artículo destripando el funcionamiento de un Singleton con .Net. Luego llegó José y también aportó un poco de luz al respecto; y yo me dije a mi mismo,

¿Pero estos de que hablan? programar un Singleton a mano, están locos o qué?

Vamos que desde el Edu definió a UNITY como “ese que hace los news” pues creo que no he creado un objeto con “new” desde hace bastante tiempo. Para los que no conocen UNITY, pues en pocas palabras es un inyector de dependencias creado por el equipo de Patterns & Practices de Microsoft que ya va por su versión 2.0 y que, como a la cerveza negra, te termina gustando cuando le agarras el gustito.

Veamos un ejemplo muy pero muy simple en el que utilizaremos una clase llamada “ClaseChorra” para validar las instancias que se creen de la misma.

El modelo de Singleton está basado en el ejemplo simple que explica Jorge en su post.

   1: class ClaseChorra

   2: {

   3:     private static ClaseChorra claseChorra;

   4:     public System.Guid Id { get; set; }

   5:     public ClaseChorra()

   6:     {

   7:         Id = System.Guid.NewGuid();

   8:     }

   9:     public override string ToString()

  10:     {

  11:         return Id.ToString();

  12:     }

  13:     public static ClaseChorra GetSingletonInstance()

  14:     {

  15:         return claseChorra ?? (claseChorra = new ClaseChorra());

  16:     }

  17: }

 

Antes de seguir >> DisclaimerHoy en España es Luernes (lunes + viernes) con lo que tampoco me estoy esforzando mucho con los ejemplos, es lo que suele suceder después de una semana ardua de trabajo.

No hace no falta que explique que si creo objetos a cholón, como explica Jorge en su post, pues tendré errores de lo más variado.
Por ejemplo el siguiente código me deja una única instancia con el mismo ID para cada ejecución de la misma:
 
   1: class Program

   2: {

   3:     static void Main(string[] args)

   4:     {

   5:         var c1 = ClaseChorra.GetSingletonInstance();

   6:         var c2 = ClaseChorra.GetSingletonInstance();

   7:         c2.Id = Guid.NewGuid();

   8:         Console.WriteLine("c1: {0}", c1);

   9:         Console.WriteLine("c2: {0}", c2);

  10:         Console.ReadLine();

  11:     }

  12: }

El resultado es:

   1: c1: 34baaf27-87de-42f7-b2ad-046e35ee65fa

   2: c2: 34baaf27-87de-42f7-b2ad-046e35ee65fa

 

Pues bien, hasta aquí el ejemplo de Jorge. Pero ¿cómo lo haríamos con UNITY?. Lo ideal es leer el artículo de MSDN “Using Lifetime Managers” donde se explican diferentes opciones para trabajar con el registro de tipos y de objetos en Unity. Yo dejaré un par de ejemplos.

Por ejemplo, en la siguiente porción de código, estoy definiendo un UnityContainer para que el mismo se encargue de crear por mí los objetos que yo necesito (recuerden las palabras del Edu > “UNITY es el que hace los news"). Utilizando el container creo las instancias c1 y c2 y luego muestro los valores de la misma.

   1: static void Main(string[] args)

   2: {

   3:     var myContainer = new UnityContainer();

   4:     myContainer.RegisterType<ClaseChorra>();

   5:     var c1 = myContainer.Resolve<ClaseChorra>();

   6:     var c2 = myContainer.Resolve<ClaseChorra>();

   7:     c2.Id = Guid.NewGuid();

   8:     Console.WriteLine("c1: {0}", c1);

   9:     Console.WriteLine("c2: {0}", c2);

  10:     Console.ReadLine();

  11: }

 

El resultado son 2 instancias diferentes de la misma clase:

   1: c1: dea932a8-7ce6-4f44-aa6c-89cb04bed186

   2: c2: 011f211a-9a83-463d-81ea-566ef0dbbdab

 

Ahora bien, si yo quisiese que siempre que se cree un objeto del tipo ClaseChorra, el mismo sea la misma instancia para todos, pues simplemente le digo a UnityContainer que tipo de LifeTimeManager debe utilizar. Existen varias opciones, pero para el siguiente ejemplo utilizaremos un PerThread, que nos ayuda a tener una única instancia del objeto por thread.

   1: static void Main(string[] args)

   2: {

   3:     var myContainer = new UnityContainer();

   4:     myContainer.RegisterType<ClaseChorra>(new PerThreadLifetimeManager());

   5:     var c1 = myContainer.Resolve<ClaseChorra>();

   6:     var c2 = myContainer.Resolve<ClaseChorra>();

   7:     c2.Id = Guid.NewGuid();

   8:     Console.WriteLine("c1: {0}", c1);

   9:     Console.WriteLine("c2: {0}", c2);

  10:     Console.ReadLine();

  11: }

 

Como bien estarás suponiendo, ahora las clases c1 y c2 son la misma:

   1: c1: 84b8087b-48f5-4519-9362-b5239603ac0a

   2: c2: 84b8087b-48f5-4519-9362-b5239603ac0a

 

Así que ya sabes, o te pones a codificar todo el patrón Singleton super-sure en tu código y dejas que “UNITY haga los news por tí” Risa

 

Saludos @ Home

El Bruno

   

Fuentes:

[ENTLIB] Does Enterprise Library vNext… Let’s Go !!!


image47dd1de4

Good,

Patterns and Practices people have begun to work in the Product Backlog in the new version of enterprise library released shortly. grigori melnik said something with regard to what is incoroporará for AZURE at this link, in addition to other Patterns and Practices related materials. For example, development guides for AZURE, etc.

What is interesting is that already begin surveys, for example is for ENTLIB + AZURE, which can put the list to the Kings Magi with the topics we want to see in upcoming versions.

A good thing to keep in mind is that after the set of surveys of the previous year, some points that many asked to include in entLib (NuGet, Silverlight, etc) today are part of the product. Open-mouthed smile

Greetings @ the estate

The Bruno

   

Source: http://blogs.msdn.com/b/agile/archive/2011/06/23/entlib-vnext-teaser.aspx

[ENTLIB] Enterprise Library vNext … te animas?


image47dd1de4

Buenas,

la gente de Patterns and Practices han comenzado a trabajar en el Product Backlog de la nueva versión de Enterprise Library que se liberará dentro de poco. Grigori Melnik ha comentado algo al respecto de lo que se incoroporará para AZURE en este link, además de otros materiales de Patterns and Practices relacionados. Como por ejemplo, guías de desarrollo para AZURE, etc.

Lo interesante es que ya empiezan las encuestas, como por ejemplo esta para ENTLIB + AZURE, con las que podremos poner la lista a los reyes magos con los temas que querramos ver en las próximas versiones.

Un buen dato a tener en cuenta es que después del set de encuestas del año anterior, algunos puntos que muchos pedíamos incluir en entLib (NuGet, Silverlight, etc) hoy son parte del producto. Open-mouthed smile

Saludos @ La Finca

El Bruno

   

Fuente: http://blogs.msdn.com/b/agile/archive/2011/06/23/entlib-vnext-teaser.aspx