Foreign Key properly set but can't access the data through foreign key.
Hello Guys, Hope everyone is doing well. First, I would like to thank everyone for contributing to this forum, I am new to ASP.NET Core and here people helped me a lot to solve my problems, I was...
View ArticleHow to update data when it is appears in more than one section by LINQ
see the screen shot see LineItem R&D and XfundCode RD appears in consensus and also in key drug section. i want if any specific combination of LineItem & XfundCode appears in multiple section...
View ArticleLINQ to display count of records not in top x
I am writing a logfile reader for our clients to use on their websites. To that end, I create a single list composed of the various files that they want to view. and then use LINQ to query the list...
View ArticleNo Overload Method for Join takes 4 arguments
this.Parts .Join(this.PartInformation, p => p.PartId, pi => pi.PartId, (p, pi) => new { p.ListId, p.PartId, pi.PartDescription });I am in a DbContext for my database. I want to join the part...
View ArticleError when update item
Hello everyone,i have a piece of code where i try to update an item : public void Update(ItemBox itemBox) { try { context.ItemBox.Update(itemBox ); context.SaveChanges(); } catch(Exception ex) { //...
View ArticleUnderstand linq expression
I have an entity named ItemBoxSup ( in table on db) and i have a method in which i pass list of items from extern of some type: ItemBoxLists.What i want to insert a check in or to see if there is...
View ArticleHow to check if something is true but not return anything else but a bool
Hi,i'm trying to write a query in entity framework core to check if a record is in the db, but i don't need to return any data. is this possible?the logic would be something like this:bool check =...
View Articlehow to convert raw sql to entity linq
this is the query i want to convert to linqselect distinct Users.Name,Packages.PName,Packages.Price,RefEarning=(select Price*ReferCommission/100) from Users inner join UserPackages on...
View ArticleOne vessel to many photos but ef core 3.1.7 and asp.net 3.1
I have a set of many vessels to which can be set to multiple photos for example lets say the following code I am using asp.net core 3.1 and ef core 3.1.7 public class FileAttachments { public int Id {...
View ArticleMicrosoft.Data.SqlClient
I'm trying (YES. TRYING.) to set up a Core 3.1 web api project in VS2019 that would include EF Core (DB 1st). I'm having a miserable time. I run Scaffold-DbContext and I get an exception:...
View ArticleCan you mix EDMX and code first with existing database?
Where I work, they have used Entity Framework's EDMX files for longer than I've been there. Every new project brings will include the older EDMX files. I prefer to use EF's code first with existing...
View ArticleLinq with Count and Group By
I'm porting legacy code that utilized stored procedures to Entity Framework Core. The stored procedure looks like:SELECT Distinct DiagnosisCode, DiagnosisCodeDescription, Count(*) as Count from...
View ArticleHow to concatenate string on a server side in Entity Framework core Linq query
I am using the newest EF core (3.1.8).My goal is to concatenate a subquery table that returns string into one single string, I don't want SQL Server to return cloned row data by subquery rows.I've...
View ArticleLinq group by question
Hi,Can I group by this?9501 England 1023 1023 London 9501 Englang 1090 1090 Manchester 9501 England 1094 1094 Liverpool 9501 England 1108 1108 Birmingham 9502 US 1181 1181 Boston 9502 US 1247 1247 New...
View ArticleQuestion about the Silly actions with Entity Framework
For the life of me I have no Idea why Entity Framework makes using SQL views sooooooooooooo difficult.My errorSeverity Code Description Project File Line Suppression State Warning Error 6013: The...
View ArticleWhy This Nonsense?? : System.Data.Entity.Core.Objects.ObjectResult`1[Some...
Ok this is just nuts... and I am guessing this is some microsoft poor QA bug that will never be fixed but I am wondering if you gurus on this forum have some way of working around this:I have a stored...
View ArticleStored procedure the second time that is called does not update the data...
Hi,I have a service class that use a entity framwork for call a strored procedure with "FromSqlRaw" method.All work fine a first time, but in second time doesn't work the chipsReport array it is not...
View ArticleConvert linq to sql query
Hi , I struggle to convert a query from linq to sql ,my query is: from box in _context.MailIteboxStore.Where(x => x.boxId == boxId) .Include(x => x.boxItem).ThenInclude(x => x.boxItemGen)...
View ArticleThe instance of entity type cannot be tracked because another instance with...
The instance of entity type 'Table' cannot be tracked because another instance with the same key value for {'Id'} is already being tracked. When attaching existing entities, ensure that only one entity...
View ArticleEF Core, first query is slow, how to generate a precompile view to improve...
Hi,I am working on webapi 3.1 with entityframework core 3.16. I got about 180 entity that is slow with the first query. I read that precompiled entityframework view can help improve performance. I...
View Article