How can I delete 1,000 rows with EF6?

EF 6 as far as I know introduced the .RemoveRange() option on your DbContext. So in short, you can do something like the following: var db = new MyDbContext(); var itemsToDelete = db.MyTable.Where(x=>!x.active); db.MyTable.RemoveRange(itemsToDelete); db.SaveChanges(); So instead of having to do any type of foreach, you can utilize this new extension method. With your Unit … Read more

Upgrade from Entity Framework 5 to 6

I think your problem is, that your T4 templates, which generate the entitties and the context are still in EF version 5. First you have to delete the current code generation items, which are in the code behind of the model, namely <Modelname>.Context.tt and <Modelname>.tt.Next add a new EF version 6 code generator with Right … Read more

Why is Entity Framework 6.1.3 throwing a “Could not load type ‘System.Data.Entity.Infrastructure.TableExistenceChecker'”

If you find as I did that EF is not installed in the Gac then the next step is to uninstall it AFTER you note the version of your package. I use NuGet so I went to Tools…Library Package Manager…Package Manager Console. I tried the GUI first but uninstalling failed and as of this writing … Read more

Enable Entity Framework 6 for MySql (C#) in WinForms of Microsoft Visual Studio 2013

First of all, we don’t even need to install the mysql-installer-community-5.7.3.0-m13.msi. Install the latest mysql-visualstudio-plugin Install the latest mysql-connector-net New C# .Net 4.5 Framework WinForms (for 4.0 it should work based on Does Entity Framework 6 support .NET 4.0? ) Install 4 Nuget Packages (follow sequence, if you install Mysql.Data.Entities before EntityFramework, it will resolve … Read more

EF 6 database first: How to update stored procedures?

Based on this answer by DaveD, these steps address the issue: In your .edmx, rt-click and select Model Browser. Within the Model Browser (in VS 2015 default configuration, it is a tab within the Solution Explorer), expand Function Imports under the model. Double-click your stored procedure. Click the Update button next to Returns a Collection … Read more

Problems using Entity Framework 6 and SQLite

Just thought I’d share another way to configure EF6 with SQLite without using app.config / web.config. EF6 now supports code based configurations as outlined here on msdn. I used the following code (updated to remove reflection thanks to Sly): public class SQLiteConfiguration : DbConfiguration { public SQLiteConfiguration() { SetProviderFactory(“System.Data.SQLite”, SQLiteFactory.Instance); SetProviderFactory(“System.Data.SQLite.EF6”, SQLiteProviderFactory.Instance); SetProviderServices(“System.Data.SQLite”, (DbProviderServices)SQLiteProviderFactory.Instance.GetService(typeof(DbProviderServices))); } … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)