Group By Linq Query
Hi Guys,I have to get below result using Linq Group by.UK 2 US 1Canada 3Below is data in List Object List<LevelPrefix> LevelList = new List<LevelPrefix> { new LevelPrefix() { Type...
View Articlequery error when using .Include / .ThenInclude
Hi,Given the code below, can anyone tell me why there's the error?Model =================== public partial class Issue1Transaction { public Issue1Transaction() {...
View Article.NET Core Data model validation question
Have an application on a server and its working fine. Not getting an error yet, but if someone adds a few columns to a table that each allow null, will this lead to model validation errors when my app...
View Article[Error running the selected code generator] with EF 6 and MVC5 project --
Hey there. Apologies in advance if the question appears too trivial. I am on VS 2017, updated to latest SDKs and runtime. I created a .NET MVC5 project. Added a DB called BookDB.mdf in my App_Data....
View ArticleEntity Framework Timeout Citing Pending Model Changes
First, I never did a code first migration before installing Identity and have not done one since because I do all my DB design work using SSMS. Lately I have been getting a timeout error after adding...
View ArticleHow Can I Create Custom Columns Using a Lambda Expression?
I want to add custom columns kind of like you can with an alias in SQL to an array generated from a model in my DB context.For instance for:var posts = await _context.Posts.Where(post =>...
View ArticleExecuteReader requires an open and available Connection. The connection is...
in my mvc4 web application, i have two Connexion string: one for remote MSSqlServer and other for local sqlExpress.i have used entity framwork version 6.1.3i have taken 3 entities Person, User that...
View ArticleUnable to seed data, getting error message: The seed entity for entity type...
Unable to seed db, The seed entity for entity type 'Logs' cannot be added because another seed entity with the same key value for {'LogsId'} has already been added: Here is the code:I have commented...
View ArticleEF invalid column name "PayAmount" - and ongoing EF misery
I have added a single column called "PayAmount" to an existing table (Transactions) with datatype money Allow Nulls to my local and remote dbs.Everything the same.On the local machine in the EF diagram...
View ArticleHow to write subquery with alias column in ado.net entity
this is my raw sql query i want to get and show names of both people who applied for the job and who posted it from Users table. now problem is i can get names of people who applied for job with raw...
View Articleinsert excel sheet to database , prevent data from being inserted multiple...
i am inserting excel sheet to database using datatables and OLEDB , the sheets have different names so i am using a data table to check for sheet names and select data from them ,the problem is the...
View ArticleHow to get exact number of elements?
Hello,I am trying to query a table. I want to get only exact size of element but couldn't manage. Buttake gets up to 5 I think.var gameBankResult = await (context.GameBanks.Where(g => g.productCode...
View ArticleSequence contains no elements
Though the underlying the view has multiple records, the statement CurrentContext.All<Resource>() is always empty which was working previously. Not sure what is missing. Getting error message...
View ArticleSQL Query and EF Core Returning Different Results
Hello All,I am using ASP .Net Core (2.1) Razor (non-MVC) Pages, with EF Core and SQL Server.In this particular scenario, I have two classes, a "ParentCity" which has a one to many relationship with...
View ArticleLinq query not bringing latest record on two table
Dear All, The following query has not to return the latest records based on the record updated time. it brings the records wrongly. List<int> resp = new List<int>() { 2, 3}; var list =...
View ArticleEF Core Fluent Api with many of entity.
Hi, I'm writing WebApi and I want to prepare my context class by the use fluent api. Same structure is easy but I'm wondering how to simplify method "OnModelCreaing". I have a few entity and each of...
View ArticleCannot insert the value NULL into column
Dear All,I have a table called Operator. It has a primary key called OperatorID.This primary key was an int before. but because I have to create an offline extension of software platform. so I changed...
View ArticleEF Core 3.1.0 - Method not found: 'System.Collections.Generic.IEnumerable`1
Hi All,When I'm deploying windows services using EF 3.1.0, the following error has occurred while executing the Linq Query. and it's working perfectly in my local machine, the issue happens while...
View ArticleHow to display data from db in list
Hi,My code: public List<Voznik> voznik(string username, string password, int IdPodjetja) { Voznik result = new Voznik(); // if (Membership.ValidateUser(username, password) && IdPodjetja...
View ArticleJoin Relationship Tables
Hey everyone. I'm learning .NET and am building a project to learn with. I've run into a an issue that I'm wondering if I can get a hand on, trying to figure out how to do it. I have three tables:...
View Article