How to specify that DateTime objects retrieved from EntityFramework should be DateTimeKind.UTC [duplicate]

No, there’s not. And it’s actually DateTimeKind.Unspecified. However, if you are concerned about supporting multiple timezones, you should consider using DateTimeOffset. It’s like a regular DateTime, except that it does not represent a “perspective” of time, it represents an absolute view, in which 3PM (UTC – 3) equals 4PM (UTC – 2). DateTimeOffset contains both …

Read more

The provider for the source IQueryable doesn’t implement IAsyncQueryProvider

I get stuck on this issue today and this lib resolve it for me https://github.com/romantitov/MockQueryable completely, please refer: Mocking Entity Framework Core operations such ToListAsync, FirstOrDefaultAsync etc. //1 – create a List<T> with test items var users = new List<UserEntity>() { new UserEntity{LastName = “ExistLastName”, DateOfBirth = DateTime.Parse(“01/20/2012”)}, … }; //2 – build mock by …

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

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