Executing SQL query in Entity Framework Core and returns a list of object
I have the below SQL query. Now I would like to execute this query in Entity Framework Core and get the below list of object. Query: select A.OrganizationId, P.Id as PreferenceId, P.PreferenceTitle, value = CASE …
Converting SQL query having sub query to LInQ
I have the below SQL query. Select a.userid, t.preferenceid, t.preferencetitle, t.isusercontrolled, value = case when( a.value is not null and a.value != t.value ) then a.value else…
Linq dynamically Add Where conditions
Hi, I am getting values from various form inputs and trying to dynamically construct the where clause. I couldn't find a way to, unfortunately. Hope you can help. Here is public async Task<IEnumerable<Order>>…
how to write this sql in efcore?
select rank() over(partition by e.Id, e.CreateTime order by e.score desc) id from ScoreInfo how to write it in ef core?
How to sort a list in ef core? or set a sort value ?
I am creating a table that can easy sort. public MyClassA { public int Id{get;set;} public string Name{get;set;} public int Sort{get;set;} } If I use int Sort to sort the list It will be difficult to add a value between two items; I…
DBContext Inherit from multiple base class
I have just implemented the DuendeIdentity Server and by DBContext looks like this. public class DataContext : ApiAuthorizationDbContext<ApplicationUser> { public DataContext( DbContextOptions options, …
Microsoft.Data.SqlClient.SqlException (0x80131904): Connection Timeout Expired. The timeout period elapsed during the post-login phase
I am seeing the following exception occur sporadically in my logs: Microsoft.Data.SqlClient.SqlException (0x80131904): Connection Timeout Expired. The timeout period elapsed during the post-login phase. The connection could have timed out while…
How to use efcore get value but may be null?
There is 2 tables: A: public int Id{get;set;} public int CreatorId{get;set;} B: public int Id{get;set;} public string Name{get;set;} I want to get the Name in B according the CreatorId in A but the CreatorId may not in B then I want…
How to get the 2 level data using ef core?
public Class MyCataA { public int Id{get;set} public int TopId{get;set;} } public Class IMGA { public int Id{get;set;} public string ImageUrl{get;set;} public int CateId{get;set;} } I am using…
Principal.WindowsImpersonationContext on .Net 6 and EF6
Hi, We are currently migrating our projects which are developed on .NET472 to .NET6.0. We had EF6 used for Oracle DB connection and it has been done via Oracle.Manageddataaccess. Now after we changed the underlying projects, we are getting below…
Linq Calculate current year and 3 months Cost
Hello, I am trying to get the current year and last 3 months' cost but couldn't figure it out. Can you help me? By the way, I am using EF Core 6. Thanks in advance. using System; using System.Linq; using System.Collections.Generic; …
Azure blob upload - if the pdf file already exists in the blob, then rename pdf file by adding a number at the end?
Hi Expert team, Below is my method and I am able to check if the file already exists in the blob Regarding Azure blob upload - if the file already exists in the blob, then I want to rename pdf file by adding a number at the end.? For…
DbContext Check all values and compare
Hello, I have orders and order details. I want to check all the order details in order to find out if the status of all the order details is completed. There are a couple of statuses; canceled, completed, continues. How to check the statuses in the…
Areas in Class Library
hi folks, I have a Project "MyProject" and another Class Library "AreaProject" project in AreaProject The url /Admin/Product/ takes me to Product Controller ,Index Action but Not able to find View …
Azure blob container - Improve performance in fetching pdf files from Azure blob container.
Hi Team, Below is my code to fetch the pdf files from Azure blob container. Most of the times the blob container contains up to 5000 pdf files. Issue i am facing: Performance is very slow and taking more time to fetch when there are more than…
How to set field with another one
Hello, I have this OrderDetail class. I want to set the Currency field to ExtendedCurrency. Can I set it in the LINQ query below? Or is it possible to set it in the class? Thank you. public async Task<IEnumerable<Order?>>…
How to get sql from a efcore sentense?
What I want to do is create a conventor from efcore to sql. for example. I have entity:MyStudent DbSet<MyStudent>MyStudents{get;set;}; and there is a textblock. I enter a sentence of efcore. var query=await…
How to get hierarchy(children or parent's), using LINQ to EF Core
I have a data structure, such as next class Entity { int Id, int EntityParentId, string Name } And I would like to get all children or parents, could you help me how can I do it with C# LINQ
EF - checking that an user cannot enter twice the same key - 12 pgms - 8 working well, 4 send an system error msg !!!
Could someone help me? How to catch that kind of exception? I cannot find the InnerException message number as for example with DBupdateException. Thanks in advance for your help. Error msg: System.InvalidOperationException: 'The instance of…
No Aceess, CORS Policy
Affecting multiple clients in metro areas ISP comcast, at end users goverment employees and public including colleges and universities. /jobs/48812/field-claim-resololution-specialist-iii,-property/login:1 Mixed Content: The page at…