/// <summary> /// Gets the entity framework context. /// </summary> /// <param name="provider">The provider.</param> /// <returns></returns> private CustomErrorPagesEFDbContext GetContext(ICustomErrorPagesEFDataProvider provider) { if (provider.ProviderContext == null) { throw new Exception(String.Format("Provider {0} is not initialized.", provider.Name)); } return(CustomErrorPagesEFDataConnection.GetContext(this.connectionName, provider)); }
public void Initialize(string providerName, NameValueCollection config, Type managerType) { this.connectionName = config["connectionName"]; if (string.IsNullOrEmpty(this.connectionName)) { this.connectionName = "Sitefinity"; /* the default connectionName */ } var provider = this.DataProvider as ICustomErrorPagesEFDataProvider; if (provider != null) { CustomErrorPagesEFDataConnection connection = CustomErrorPagesEFDataConnection.InitializeConnection(this.connectionName, provider); provider.ProviderContext = new CustomErrorPagesEFDataProviderContext() { ProviderKey = Guid.NewGuid().ToString(), ConnectionId = connection.Name }; this.connectionName = connection.Name; } }