cypherpotato
cypherpotato
CC#
Created by cypherpotato on 12/14/2024 in #help
EF Core not creating migrations
nvm i'm going to use petapoco
11 replies
CC#
Created by cypherpotato on 12/14/2024 in #help
EF Core not creating migrations
@lycian just ran the command with -verbose flag and this was the output:
Using project 'chiyo'.
Using startup project 'chiyo'.
Build started...
Build succeeded.
C:\Program Files\dotnet\dotnet.exe exec --depsfile C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.deps.json --additionalprobingpath C:\Users\gscat\.nuget\packages --additionalprobingpath "C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages" --runtimeconfig C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.runtimeconfig.json C:\Users\gscat\.nuget\packages\microsoft.entityframeworkcore.tools\9.0.0\tools\netcoreapp2.0\any\ef.dll migrations add Initial --json --verbose --no-color --prefix-output --assembly C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.dll --project C:\Code\repos\chiyo\chiyo.csproj --startup-assembly C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.dll --startup-project C:\Code\repos\chiyo\chiyo.csproj --project-dir C:\Code\repos\chiyo\ --language C# --configuration Debug --working-dir C:\Code\repos\chiyo --root-namespace chiyo --nullable
Using assembly 'chiyo'.
Using startup assembly 'chiyo'.
Using application base 'C:\Code\repos\chiyo\bin\Debug\net9.0'.
Using working directory 'C:\Code\repos\chiyo'.
Using root namespace 'chiyo'.
Using project directory 'C:\Code\repos\chiyo\'.
Remaining arguments: .
Finding DbContext classes...
Finding IDesignTimeDbContextFactory implementations...
Finding DbContext classes in the project...
Found DbContext 'DbConnection'.
Finding application service provider in assembly 'chiyo'...
Finding Microsoft.Extensions.Hosting service provider...
Using environment 'Development'.
Using project 'chiyo'.
Using startup project 'chiyo'.
Build started...
Build succeeded.
C:\Program Files\dotnet\dotnet.exe exec --depsfile C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.deps.json --additionalprobingpath C:\Users\gscat\.nuget\packages --additionalprobingpath "C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages" --runtimeconfig C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.runtimeconfig.json C:\Users\gscat\.nuget\packages\microsoft.entityframeworkcore.tools\9.0.0\tools\netcoreapp2.0\any\ef.dll migrations add Initial --json --verbose --no-color --prefix-output --assembly C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.dll --project C:\Code\repos\chiyo\chiyo.csproj --startup-assembly C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.dll --startup-project C:\Code\repos\chiyo\chiyo.csproj --project-dir C:\Code\repos\chiyo\ --language C# --configuration Debug --working-dir C:\Code\repos\chiyo --root-namespace chiyo --nullable
Using assembly 'chiyo'.
Using startup assembly 'chiyo'.
Using application base 'C:\Code\repos\chiyo\bin\Debug\net9.0'.
Using working directory 'C:\Code\repos\chiyo'.
Using root namespace 'chiyo'.
Using project directory 'C:\Code\repos\chiyo\'.
Remaining arguments: .
Finding DbContext classes...
Finding IDesignTimeDbContextFactory implementations...
Finding DbContext classes in the project...
Found DbContext 'DbConnection'.
Finding application service provider in assembly 'chiyo'...
Finding Microsoft.Extensions.Hosting service provider...
Using environment 'Development'.
it get stuck under this last line "Using environment"...
11 replies
CC#
Created by cypherpotato on 12/14/2024 in #help
EF Core not creating migrations
No description
11 replies
CC#
Created by cypherpotato on 12/14/2024 in #help
EF Core not creating migrations
Yea, I tried.
11 replies
CC#
Created by cypherpotato on 12/14/2024 in #help
EF Core not creating migrations
It's a solution with only one project on it
11 replies
CC#
Created by cypherpotato on 12/14/2024 in #help
EF Core not creating migrations
https://gist.github.com/CypherPotato/51ccf17896d02a3f16da3d1c2bb07785 I'm currently on .NET 9 and EF Core 9.0.0 with Sqlite
11 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
also i'll follow the tip of naming of anonymous objects
33 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
but yea, thank you guys
33 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
what no
33 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
No description
33 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
but I've always seen anonymous members closer to fields than properties
33 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
the JSON is configured to sent everything as camelCase btw
33 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
hahaa you're right
33 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
what
33 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
nope. my foreign keys are set in OnModelCreating. I don't use navigation in models
33 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
this was the final query
33 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
C#
var query = Database.KanbanColumns
.Where(c => c.ParentBoardId == boardId)
.OrderBy(c => c.Order)
.Select(c => new
{
Column = c,
Cards = Database.KanbanCards
.Where(a => a.ParentColumnId == c.Id)
.OrderBy(a => a.Order)
.ToArray()
});

foreach (var data in query)
{
yield return new
{
column = new
{
data.Column.Id,
data.Column.Color,
data.Column.Label
},
cards = data.Cards
.Select(a => new
{
a.Id,
Title = a.CardTitle,
Info = new
{
a.CreatedAt,
a.Value,
a.Temperature,
AssociatedUsers = a.AssociatedUsers
.Select(n => AdapterCacheUnit.FetchUser(n))
.Where(n => n != null)
.Select(n => new
{
n!.UniqueId,
n.UserName,
n.ProfilePictureUrl
})
}
})
};
}
C#
var query = Database.KanbanColumns
.Where(c => c.ParentBoardId == boardId)
.OrderBy(c => c.Order)
.Select(c => new
{
Column = c,
Cards = Database.KanbanCards
.Where(a => a.ParentColumnId == c.Id)
.OrderBy(a => a.Order)
.ToArray()
});

foreach (var data in query)
{
yield return new
{
column = new
{
data.Column.Id,
data.Column.Color,
data.Column.Label
},
cards = data.Cards
.Select(a => new
{
a.Id,
Title = a.CardTitle,
Info = new
{
a.CreatedAt,
a.Value,
a.Temperature,
AssociatedUsers = a.AssociatedUsers
.Select(n => AdapterCacheUnit.FetchUser(n))
.Where(n => n != null)
.Select(n => new
{
n!.UniqueId,
n.UserName,
n.ProfilePictureUrl
})
}
})
};
}
33 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
yea by the end i've rewrited the entire query to use IEnumerable instead
33 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
I thought I could use AsEnumerable in nested queries. If I use it at the root, will the nested queries also be executed on the client side?
33 replies
CC#
Created by cypherpotato on 11/19/2024 in #help
✅ Why ins't this EF Core query being evaluated client-side?
Btw i'm getting the following exception, telling my expression ins't being evaluated on client side.
System.InvalidOperationException: The LINQ expression 'n => AdapterCacheUnit.FetchUser(n)' could not be translated.
Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call
to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038
for more information.
System.InvalidOperationException: The LINQ expression 'n => AdapterCacheUnit.FetchUser(n)' could not be translated.
Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call
to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038
for more information.
what am I doing wrong?
33 replies