entity-framework-core-3.0

Simplest Group By Fails in EF 3.x with “Client side GroupBy is not supported”

会有一股神秘感。 提交于 2020-05-15 07:52:07
问题 Currently testing with EF Core version 3.1.1. When I search, I find references to this problem, but I don't see any definitive answers about why this happens, and whether it is a bug that will be fixed or if it's expected behavior. This is just as simple as it looks--the BatchRequest table/entity has an integer column/property called BatchId: var batchRequestGroups = context.BatchRequests.GroupBy(br => br.BatchId).ToList(); When I run this, I get a System.InvalidOperationException, "Client

Simplest Group By Fails in EF 3.x with “Client side GroupBy is not supported”

我们两清 提交于 2020-05-15 07:51:19
问题 Currently testing with EF Core version 3.1.1. When I search, I find references to this problem, but I don't see any definitive answers about why this happens, and whether it is a bug that will be fixed or if it's expected behavior. This is just as simple as it looks--the BatchRequest table/entity has an integer column/property called BatchId: var batchRequestGroups = context.BatchRequests.GroupBy(br => br.BatchId).ToList(); When I run this, I get a System.InvalidOperationException, "Client

Entity Framework 3.0 Contains cannot be translated in SQL as it was in EF Core 2.2

旧城冷巷雨未停 提交于 2020-04-10 14:04:07
问题 I am trying to migrate a Web API from .NET Core 2.2 to .NET Core 3.0 and I have stumbled across the following: public Dictionary<int, Tag> GetTagMap(IList<int> tagIds = null) { var tags = context.Tag.AsNoTracking(); if (tagIds != null) tags = tags.Where(t => tagIds.Contains(t.TagId)); return tags .ToList() // explicit client evaluation in 3.0 .ToDictionary(t => t.TagId, t => t); } This used to generate a SQL statement similar to this one: SELECT TagId, Name FROM Tag WHERE TagId IN (1, 2, 3)

Entity Framework 3.0 Contains cannot be translated in SQL as it was in EF Core 2.2

被刻印的时光 ゝ 提交于 2020-04-10 14:03:18
问题 I am trying to migrate a Web API from .NET Core 2.2 to .NET Core 3.0 and I have stumbled across the following: public Dictionary<int, Tag> GetTagMap(IList<int> tagIds = null) { var tags = context.Tag.AsNoTracking(); if (tagIds != null) tags = tags.Where(t => tagIds.Contains(t.TagId)); return tags .ToList() // explicit client evaluation in 3.0 .ToDictionary(t => t.TagId, t => t); } This used to generate a SQL statement similar to this one: SELECT TagId, Name FROM Tag WHERE TagId IN (1, 2, 3)

Entity Framework 3.0 Contains cannot be translated in SQL as it was in EF Core 2.2

半腔热情 提交于 2020-04-10 14:02:06
问题 I am trying to migrate a Web API from .NET Core 2.2 to .NET Core 3.0 and I have stumbled across the following: public Dictionary<int, Tag> GetTagMap(IList<int> tagIds = null) { var tags = context.Tag.AsNoTracking(); if (tagIds != null) tags = tags.Where(t => tagIds.Contains(t.TagId)); return tags .ToList() // explicit client evaluation in 3.0 .ToDictionary(t => t.TagId, t => t); } This used to generate a SQL statement similar to this one: SELECT TagId, Name FROM Tag WHERE TagId IN (1, 2, 3)

My Context does not inherit from DbContext in Entity Framework Core

寵の児 提交于 2020-01-14 02:31:08
问题 I am trying to keep BooksContext.cs file in a folder called Contexts . I have a single Book class inside Entities folder. Hence, below is the code in BookContext.cs file. I have used the following command at Package Manager Console to enable migrations. PM>Enable-Migrations -ContextTypeName Books.API.Contexts.BooksContext But, I'm getting below error: The type BooksContext does not inherit from DbContext . The DbMigrationsConfiguration.ContextType property must be set to a type that inherits

EF Linq Error after change from dotnet Core 2.2.6 to 3.0.0

爱⌒轻易说出口 提交于 2020-01-09 10:40:02
问题 I'm trying to upgrade a solution to the new Core Framework 3.0.0. Now I'm having a small issue I don't understand. Look, this method was unproblematic in 2.2.6: public async Task<IEnumerable<ApplicationUser>> GetBirthdayUsersCurrentMonth() { return await ApplicationDbContext.Users .Where(x => x.Gender != ApplicationUser.GenderTypes.generic) .Where(x => x.BirthDate.GetValueOrDefault().Month == DateTime.Now.Month) .Where(x => x.RetireDate == null) .OrderBy(x => x.BirthDate.GetValueOrDefault())

dotnet ef command no longer works after upgrading to Visual Studio 16.3.0

折月煮酒 提交于 2019-12-11 00:39:39
问题 This happened at home first, so I thought maybe it was an issue with my desktop PC at home. But now that I am back at work, I tried the upgrade and got the same thing. Screenshot before upgrade Screenshot after upgrading Visual Studio The error I get is: Could not execute because the specified command or file was not found. Possible reasons for this include: You misspelled a built-in dotnet command. You intended to execute a .NET Core program, but dotnet-ef does not exist. You intended to run

Client side GroupBy is not supported

↘锁芯ラ 提交于 2019-12-05 17:24:48
问题 I have the following Entity Framework Core 3.0: var units = await context.Units .SelectMany(y => y.UnitsI18N) .OrderBy(y => y.Name) .GroupBy(y => y.LanguageCode) .ToDictionaryAsync(y => y.Key, y => y.Select(z => z.Name)); And I get the following error: Client side GroupBy is not supported. Why am I getting this error if I am not running the query on the client? To run the query on the client, or part of it, I would do the following: var units = context.Units .SelectMany(y => y.UnitsI18N)

Client side GroupBy is not supported

﹥>﹥吖頭↗ 提交于 2019-12-04 03:44:52
I have the following Entity Framework Core 3.0: var units = await context.Units .SelectMany(y => y.UnitsI18N) .OrderBy(y => y.Name) .GroupBy(y => y.LanguageCode) .ToDictionaryAsync(y => y.Key, y => y.Select(z => z.Name)); And I get the following error: Client side GroupBy is not supported. Why am I getting this error if I am not running the query on the client? To run the query on the client, or part of it, I would do the following: var units = context.Units .SelectMany(y => y.UnitsI18N) .OrderBy(y => y.Name) .AsEnumerable() .GroupBy(y => y.LanguageCode) .ToDictionary(y => y.Key, y => y.Select