44 questions from the last 365 days
Best practices
0
votes
7
replies
137
views
C# Entity Framework issue when working with SQL Server in blog project
I'm studying C# and currently working on a blog project using SQL Server. I’m having trouble understanding a specific part of my code when things get more complex.
I’ve tried to figure it out on my ...
Advice
0
votes
7
replies
129
views
How to filter a query with the values from a list in ef core
I have a list that is the result of a db query. I need to be able to query another table but filter that query based on the first list. In a perfect world I would join these two tables but they are ...
0
votes
1
answer
118
views
Depending DataSeeding in Abp framework
I tried to DataSeed some data, but I got this error: SqlException: The MERGE statement conflicted with the FOREIGN KEY constraint "FK_SubCategories_Categories_CategoryId".
1st I tried to do ...
0
votes
4
answers
283
views
SQL query running slow
I have the following query generated by EF:
SELECT
[t].[Id], [t].[ActiveStateLicenseId], [t].[AvailableDate], [t].[City],
[t].[CreatedBy], [t].[CreatedOn], [t].[DateOfBirth], [t].[Email],
...
0
votes
1
answer
128
views
How to apply a two-levels' SelectMany using expressions in a generic way in C#
Let's have 3 entities with the same base class for ID's:
public class EntityBase
{
public int Id { get; set; }
}
public class Company : EntityBase
{
public string Brand { get; set; }
public ...
1
vote
2
answers
98
views
Linq query io.DrpString.Contains(dienstregelpunt) could not be translated
I keep getting error
.DrpString.Contains(dienstregelpunt)' could not be translated.
I have a string[] dienstregelpunten array and a database field containng dienstregelpunten as a csv field. See ...
2
votes
1
answer
138
views
Entity Framework/Linq Get Last Record From List With Condition
I have a list of records, by multiple UserID's.
TableID UserID Status
------------------------
1 3 3
2 4 3
3 3 4
4 4 3
5 5 4
6 ...
Tooling
0
votes
3
replies
121
views
Is there a Database First approach in Java like Entity Framework in C#?
I’m used to working with a Database First approach in C#. I design my database schema (often with MySQL Workbench) and do a forward engineering, then generate my C# models using Entity Framework’s. ...
4
votes
2
answers
768
views
error MSB4057: The target "ResolvePackageAssets" does not exist in the project
I tried adding a migration via dotnet ef migrations add InitialCreate but got the following error
C:\Users\tmsta\OneDrive\source\repos\Server Default\TrevorsTempMonitorApp\TrevorsTempMonitorApp.csproj ...
Advice
0
votes
2
replies
53
views
How to set the value in the basic many-to-many relationship example of EF?
Here's a basic example from the official .NET documentation for a many-to-many relationship using EF and .NET:
public class Post
{
public int Id { get; set; }
public List<Tag> Tags { get;...
1
vote
4
answers
230
views
How to use .Include() in Entity Framework across classes without repetition [closed]
I am looking for a way to use the .Include clause of Entity Framework while avoiding duplicate code.
I have a lot of classes, and every class has a method which looks something like this:
query = (...
2
votes
1
answer
104
views
How can I instantiate and populate nested/complex objects with Select() in Entity Framework 6?
I am attempting to backport some code written with Entity Framework Core to Entity Framework 6. I've encountered an issue where EF Core can successfully instantiate a complex DTO (i.e. an object with ...
1
vote
1
answer
123
views
How would I use N.EntityFramework.Extensions to insert into another table
I am trying to use the InsertFromQuery() to add data to a SQL table:
await cx.Users
.Where(x => x.Country == "Romania")
.InsertFromQueryAsync("Mailbox", mb => ...
0
votes
1
answer
168
views
SQL query produced by Entity Framework very slow
I have the following query being generated by EF:
DECLARE @__term_0 VARCHAR(7) = 'woodrow'
DECLARE @__p_1 INT = 0
DECLARE @__p_2 INT = 15
SELECT [t].[Id], [t].[City], [t].[Contact], [t].[CreatedBy], [...
1
vote
0
answers
83
views
Mysql ConnectionAttempts increased on AWS RDS after dotnet 6 update to 8
After updating our Dotnet API from dotnet 6 to 8 the connection-attemps on AWS RDS increased significantly (see attached picture).
The API is running in a docker-container.
We use a MYSQL RDS instance ...