title: How to implement transient fault handling pattern with entity framework
body: <p>I need to implement the following pattern:
  <a href="https://msdn.microsoft.com/en-us/library/dn589799.aspx" rel="nofollow noreferrer">https://msdn.microsoft.com/en-us/library/dn589799.aspx</a></p>
  
  <p>I read on a book that following:</p>
  
  <blockquote>
    <p>If you are using Entity Framework 6 (EF 6), the retry logic for
    transient faults is built in to the framework. When your EF 6 model is
    in your project, you need to create a new class that derives from
    DbConfiguration and customizes the execution strategy in the
    constructor. EF 6 will look for classes that derive from
    DbConfiguration in your project and use them to provide resiliency. To
    set this, add a new Class file to your project and add using
    statements for System.Data.Entity and System.Data.Entity.SqlServer.</p>
  </blockquote>
  
  <p>The code is as follows:</p>
  
  <pre><code>  public class EFConfiguration : DbConfiguration
      {
          public EFConfiguration()
          {
              this.SetExecutionStrategy("System.Data.SqlClient", () =&gt; new SqlAzureExecutionStrategy());
          }
      }
  </code></pre>
  
  <p>However I am not sure how to implement it on my code:</p>
  
  <pre><code>public class AppDataContext : DbContext
      {
  
          public AppDataContext() : base("AppDataContext")
          {
          }
  
          public DbSet&lt;Module&gt; Modulos { get; set; }
  
          public DbSet&lt;Empresa&gt; Empresas { get; set; }
  
          public DbSet&lt;Entidad&gt; Entidades { get; set; }
  
          public DbSet&lt;Propiedad&gt; Propiedades { get; set; }
  
  
          protected override void OnModelCreating(DbModelBuilder modelBuilder)
          {
              modelBuilder.Conventions.Remove&lt;PluralizingTableNameConvention&gt;();
          }
  
      }
  
   public class AppDataContextInitializer : System.Data.Entity.DropCreateDatabaseAlways&lt;AppDataContext&gt;
      {
          protected override void Seed(AppDataContext context)
          {
              #region Seed Modules
                  context.Modulos.Add(new Module() { Id = 1, ModuleName = "Contabilidad", FontAwesomeClass = "fa-ambulance" });
                  context.Modulos.Add(new Module() { Id = 2, ModuleName = "Recursos Humanos", FontAwesomeClass = "fa-heartbeat" });
                  context.Modulos.Add(new Module() { Id = 3, ModuleName = "Inventario", FontAwesomeClass = "fa-anchor" });
                  context.Modulos.Add(new Module() { Id = 3, ModuleName = "Produccion", FontAwesomeClass = "fa-binoculars" });
                  context.Modulos.Add(new Module() { Id = 3, ModuleName = "Ventas", FontAwesomeClass = "fa-coffee" });
                  context.Modulos.Add(new Module() { Id = 3, ModuleName = "Compras", FontAwesomeClass = "fa-calendar-o" });
                  context.Modulos.Add(new Module() { Id = 3, ModuleName = "Cotizaciones", FontAwesomeClass = "fa-building" });
              #endregion
  
              #region Seed Empresas
              context.Empresas.Add(new Empresa() { Id = 1,
                  Nombre = "XYA",
                  NIT = "900854343",
                  NombreRepresentanteLegal = "Carla Peresz",
                  TelefonoRepresentanteLegal = "123",
                  NombreContacto = " Esteban Andres",
                  TelefonoContacto = "123"
                  });
              #endregion
  
              #region Seed Entidades
              context.Entidades.Add(new Entidad()
              {
                  Id = 1,
                  Nombre = "Empresa",
                  Propiedades = new List&lt;Propiedad&gt;()
                      {
                          new Propiedad()
                          {
                              Codigo="01",
                              Nombre="Twitter",
                              TipoDeDatos="Texto"
                          }
                      }
                  });
              #endregion
  
              #region Seed Propiedad
  
  
              #endregion
  
              base.Seed(context);
          }
      }
  </code></pre>