All Questions
388 questions
-2
votes
1
answer
113
views
How to use query with quotes inside a parent query [closed]
I have a use case, where I need to update column value which is itself a query.
Table structure:
CREATE TABLE MyTable
(
ID int,
Query varchar(max)
)
Update query:
UPDATE MyTable
SET Query =...
0
votes
0
answers
28
views
Use some kind of helper function In EF Select query to make subquery [duplicate]
I have several tables that handles different kinds of translations for my entities and those tables to linked via relations to other entities.
I use subquery to directly access translations tables ...
0
votes
2
answers
73
views
How do I do an inner GroupJoin on dotnet?
I'm using .NET 6 with Entity Framework. This is my situation:
I have a BenefitEntity (with Name and Description properties and a relationship with BenefitCategory) and this BenefitCategory which has ...
0
votes
1
answer
37
views
SQL to Linq conversion with SYSDATETIMEOFFSET
Could someone assist me in converting following sql query to LINQ? Important part of this one is to be able to convert the date to a UTC date (with daylight savings).
SELECT a.id, b.id
FROM ...
0
votes
0
answers
36
views
Fetch all data with their column using EF and raw query without creating model classes
I am coding an application for myself (kinda like a phpMyAdmin interface) where I have an input/text that's gonna send a query to the backend (I am using EF and MySQL with Xampp). With this raw query (...
0
votes
0
answers
180
views
SQL exception catcher in Entity Framework 6
I need to catch a SQL exception when executing a query in Entity Framework 6. In EF Core, there is a DbCommandInterceptor and its method CommandFailed(DbCommand, CommandErrorEventData) for this.
Does ...
0
votes
1
answer
53
views
EF 6 Update query and Where clause with list of integers comparison
In EF 6.0 I want to update some records based on a WHERE filter. Records which I recognize from a list of integers of ids. The problem is it sees the id list as an nvarchar "61, 62, 63" and ...
0
votes
0
answers
44
views
Store object that has a List of objects as a property, without these objects generating a seperate table
I have this class that has 2 complex properties:
public class App
{
[Key]
public Guid Id { get; set; }
public string StringId { get; set; } = string.Empty;
public string AppName { get; ...
1
vote
1
answer
463
views
EF Core: Sort table based on List of int that corresponds with a column in that table
I have a list:
List<int> ids = new List<int>(){ 1, 2, 3 }
And a table TableA.
I have an IQueryable<TableA>, which is not enumerated.
TableA has an column named Id.
I want to order ...
0
votes
1
answer
397
views
How do I insert nested objects correctly in Ef
I had a problem trying to add object from dto.
I have a DTO like this
public class CustomerCourseSessionDto : IDto
{
public int Id { get; set; }
public int? ConnectorId { get; set; }
...
0
votes
0
answers
17
views
IDs are incremented by omitting some of them
I have an API in written in NET 6 and a MSSQL database. Because I use Entity Framework as context, I have a table with migrations where (i don't know if matter, but just to be said)
All tables (api ...
0
votes
1
answer
122
views
Tables having one to many relationship generates outer join
I have 2 tables
public class Department : DbContext
{
public int DeptId {get; set;}
public string DeptName {get; set;}
public virtual List<Student> Students {get; set;}
}
public class ...
-1
votes
3
answers
55
views
Indexing on product table's Column (itemId)
I want to do indexing on product table's column i.e ItemId.
product's table primary key is Id. by default primary key i.e Id is clusted index
I want to do indexing in one column i.e itemId
the images ...
0
votes
1
answer
294
views
Entity Framework 6 How to make a subquery
code:
int companiesId = context.Users.Where(x => x.Id == UserId).Select(x => x.Companies.Id).FirstOrDefault();
tasksList1 = context.Tasks.Where(x => x.User.Companies.Id == ...
2
votes
0
answers
2k
views
Entity Framework .net 6.0 Sql Query Cant find
I want to run the sp in the database. but sql query gives reference error. It doesn't suggest anything as a using instead.
code:
var allUsersAndCountry = context.Database.SqlQuery<ListTaskViewModel&...