DotConnect for Postgresql with Entity Developer - How use ConnectionLost Event
Hi,
I am using DotConnect for Postgresql with Entity Developer (edml Data Model) in an ASP.NET Framework, C# and Entity Framework 5.0 application; Sometimes the connection with the Postgresql database is lost, how can I use the ConnectionLost Event in the connection code that is automatically generated by Entity Developer?
This is the connection string:
- <connectionStrings>
- <add name="AartePostgreSqlEntitiesConnectionString" connectionString="metadata=res://Aarte.Model/Aarte.Model.PostgreSql.AarteDataModel.csdl|res://Aarte.Model/Aarte.Model.PostgreSql.AarteDataModel.ssdl|res://Aarte.Model/Aarte.Model.PostgreSql.AarteDataModel.msl;provider=Devart.Data.PostgreSql;provider connection string="User Id=aartet0004;Password=xxxxxx;Host=localhost;Database=t0004;Persist Security Info=True;Initial Schema=aarte""
- providerName="System.Data.EntityClient" />
- </connectionStrings>
This is the code generated by Entity Developer:
- /// <summary>
- /// No Metadata Documentation available.
- /// </summary>
- public partial class AarteContext : ObjectContext
- {
- #region Constructors
- /// <summary>
- /// Initialize a new AarteContext object.
- /// </summary>
- public AarteContext() :
- base(@"name=AartePostgreSqlEntitiesConnectionString", "AarteContext")
- {
- this.ContextOptions.LazyLoadingEnabled = true;
- OnContextCreated();
- }
- /// <summary>
- /// Initializes a new AarteContext object using the connection string found in the 'AarteContext' section of the application configuration file.
- /// </summary>
- public AarteContext(string connectionString) :
- base(connectionString, "AarteContext")
- {
- this.ContextOptions.LazyLoadingEnabled = true;
- OnContextCreated();
- }
- /// <summary>
- /// Initialize a new AarteContext object.
- /// </summary>
- public AarteContext(EntityConnection connection) : base(connection, "AarteContext")
- {
- this.ContextOptions.LazyLoadingEnabled = true;
- OnContextCreated();
- }
- #endregion