<commit_before>﻿Elmah.Contrib.EntityFramework
===

Provides the way to integrate [Elmah](http://code.google.com/p/elmah/) with [Microsoft ADO.NET Entity Framework](http://entityframework.codeplex.com/). Initially written in F# but then rewritten in C#.

Description
===

You may want not to keep in Web.config both connection strings for Entity Framework (used by your project) and for SQL Server (used by Elmah.SqlServer) duplicating each other.
The goal of this library is to extract the underlying provider connection string from the EF connection string so only one will be kept in Web.config.

Also you can query Elmah errors table using LINQ to Entities having strongly-typed POCO entities.

Comments and contributions are very welcomed!

Examples
===
With Model/Database First approach:
```
<configuration>
	<connectionStrings>
		<add name="ModelContainer" connectionString="metadata=res://*/;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=localhost;Initial Catalog=Northwind;Integrated Security=True;&quot;" providerName="System.Data.EntityClient" />
	</connectionStrings>
	<elmah>
		<errorLog type="Elmah.Contrib.EntityFramework.EntityErrorLog, Elmah.Contrib.EntityFramework" connectionStringName="ModelContainer" />
	</elmah>
</configuration>
```

With Code First approach. To query for existing errors:
```
var elmahContext = new ElmahContext(nameOrConnectionString);
var errors = await elmahContext.Errors.ToArrayAsync();
```

Tou can also specify the table name to map:
```
var elmahContext = new ElmahContext(nameOrConnectionString, "MyElmahErrorsTable");
```

To add new error:
```
elmahContext.Errors.Add(
	new ElmahError
	{
	});
await elmahContext.SaveChangesAsync();
```

Remarks
===

You can use either `EntityErrorLog` (requires `providerName="System.Data.EntityClient"`) or `EntityContext` (requires `providerName="System.Data.SqlClient"`) but not both.

Downloads
===
Available on [NuGet](https://www.nuget.org/packages/Elmah.Contrib.EntityFramework)

Release notes
===

1.3.0:
<commit_msg>Updating readme<commit_after>﻿Elmah.Contrib.EntityFramework
===

Provides the way to integrate [Elmah](http://code.google.com/p/elmah/) with [Microsoft ADO.NET Entity Framework](http://entityframework.codeplex.com/). Initially written in F# but then rewritten in C#.

Description
===

You may want not to keep in Web.config both connection strings for Entity Framework (used by your project) and for SQL Server (used by Elmah.SqlServer) duplicating each other.
The goal of this library is to extract the underlying provider connection string from the EF connection string so only one will be kept in Web.config.

Also you can query Elmah errors table using LINQ to Entities having strongly-typed POCO entities.

Comments and contributions are very welcomed!

Examples
===
With Model/Database First approach:
```
<configuration>
	<connectionStrings>
		<add name="ModelContainer" connectionString="metadata=res://*/;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=localhost;Initial Catalog=Northwind;Integrated Security=True;&quot;" providerName="System.Data.EntityClient" />
	</connectionStrings>
	<elmah>
		<errorLog type="Elmah.Contrib.EntityFramework.EntityErrorLog, Elmah.Contrib.EntityFramework" connectionStringName="ModelContainer" />
	</elmah>
</configuration>
```

With Code First approach. To query for existing errors:
```
var elmahContext = new ElmahContext(nameOrConnectionString);
var errors = await elmahContext.Errors.ToArrayAsync();
```

Tou can also specify the table name to map:
```
var elmahContext = new ElmahContext(nameOrConnectionString, "MyElmahErrorsTable");
```

To add new error:
```
elmahContext.Errors.Add(
	new ElmahError
	{
	});
await elmahContext.SaveChangesAsync();
```

Remarks
===

You can use either `EntityErrorLog` (requires `providerName="System.Data.EntityClient"`) or `EntityContext` (requires `providerName="System.Data.SqlClient"`) but not both.

Downloads
===
Available on [NuGet](https://www.nuget.org/packages/Elmah.Contrib.EntityFramework)

Release notes
===

1.4.0:

[~] Fixing table mapping, now it's `public DbSet<ElmahError> ElmahErrors { get; set; }`

[~] Moving mapping to the separate class inheriting `EntityTypeConfiguration<T>`

[~] Setting database initializer to null

[+] Supporting schema name other than dbo

1.3.0:

{'fraction_non_alphanumeric': 0.11062557497700092, 'fraction_numerical': 0.0020699172033118675, 'mean_word_length': 5.914149443561208, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3557968', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1268, 'n_words': 397}