Content
Executing Stored Procedures based on condition in Razor Pages
Hi, I have a function that executes two stored procedures based on a condition. Stored procedure for the first condition works fine, but stored procedure for the second condition fails. public async Task<JsonResult>…


EF Core 7 - System.InvalidOperationException
Hi, Can someone please help? I am trying to insert a record with an FK using DBContext. EF Core keeps saying that the Country is already tracked. I am aware that EF Core thinks that I am inserting a new country but that's not my intention. In the below…


Bilgisayarıma .net 7.0 kurdum fakat powershell üzerinden dotnet tool install --global dotnet-ef komutu kullandığım zaman kurulu değil hatası alıyorum yardımcı olur musunuz
Visual Studio 2019 kullanıyorum ancak bu kurulumu yapamadım yardımcı olursanız sevinirim


New optional Foreign Key triggers Exception when querying
Hello there! I ran into an issue that I don't understand, therefore here I am. Here is my model: public class Property : FullAuditedEntity<Guid>, IMayHaveTenant { public int? TenantId { get; set; } …


Duplicate primary key name when running Update-Database
I am using EF Core 7, with LIve Migrations enable in a code first project. I have a model using TPT strategy. When I generate the model, it gives me the error: Failed executing DbCommand (10ms) [Parameters=[], CommandType='Text',…


Deserialising a Json string throwing error in razor pages.
Hi , I have a jsonresult like shown below "{\r\n "AccessRights": [],\r\n "ADAttributes": [\r\n {\r\n \ "AD": "teenajohn",\r\n \ "ADFull": "",\r\n …


EF Model snapshot dev vs prod
Hi, I've an app with EF core, Model First. I created a seed data set for testing my an during the dev phase. I'd like to generate my prod DB, but the dev data are inserted in my prod db. That's an issue... I use the #If DEBUG verb to exclude data from my…


Huge performance difference - EF Core/Linq/C# vs 'raw SQL'
Hello I have a query using EF Core and Linq in C#. I can paraphrase the query as selecting the average item value for items that appear on an order within a date range (Order has many Items, Item belongs to 1 Order): var q = this.DbSet…


Add-migration Build Failed
When using EF Core 7's Add-Migration cmdlet, I encounter this error: An assembly specified in the application dependencies manifest (MyProject.deps.json) was not found: package: 'runtimepack.Microsoft.Windows.SDK.NET.Ref', version:…


Failed Executing DbCommand during Entity Framework migration in .NetCORE Web API --
I created a .netcore webapi targeting framework 3.1. Added the required classes and code in ApplicationUser and ApplicationDbContext and in startup services.AddDbContext<.......... Then I ran command add-migration IniCr which built and ran ok. But…


asp.net core 6 EF scaffolding
Hello, I am creating Asp.net core 6 web api with oracle 19 as backend. i am using DB first approach and create model object from DB table. i used the below syntax, scaffold-dbcontext "Data…


Microsoft.EntityFrameworkCore.AutoHistory 5.0.8 not working in .net framework 6.0
Initially we have framework version 3.1 and Entity framework autohistory 2.1 Then we have upgraded the version framework version 6.0 and Entity framework autohistory 5.0.8 After upgraded framework version autohistory not working and it's throw an…


FromSqlRaw FirstOrDefault
Hello everyone and thanks for the help in advance. I am using EntityFramework Core in an application. I need to use FromRawSql to utilize pre-existing stored procedures that utilize some complex queries. However, when I use: visit =…
foreign key one-to-may doesn't working in blazor wasm net. ore6
Hi, I try to implement the Foreign Key in my app to link several actions,class model ActionItem with main table Developer. When I run app the ActionItem is null. Have you some advise ? you can find github link AppWebFK When run my app I…
I want to scaffold dbcontext efcore in .net 6 web API from Azure Sql Database
Hello, I have an issue, i'm trying to create models from my existing database which is a azure sql database. now when i run the below command it is giving me object reference not set to an instance error and I don't know what exactly I'm passing as…


4.6.1 migrating to .Net Core 7 – How do I resolve error MC1000- cannot find type System.Management.Instrumentation.InstrumentedAttribute in Assembly ..path \.nuget\packages\system.management\7.0.0\lib\net6.0\SystemManagement.dll – Microsoft.WinFx.Targets
I am migrating a .netFramework 4.6.1 application to core. I have been able to get rid of all of the build errors except this one: Error MC1000 Unknown build error, 'Could not find type 'System.Management.Instrumentation.InstrumentedAttribute' in…


How to migrate from entity frame work 6 to ef 7 i upgraded to ef 7 but not getting the latest features i an using repository pattern
How to migrate from entity frame work 6 to ef 7 i upgraded to ef 7 but not getting the latest features i an using repository pattern i have update to dotnet 7 and ef 7 but nothing helped


websecurity login not logged success althogth i have same user name and password on membership table ?
I working on c# web application i use the following code to login but it not logged success it show model state error although i have same user name and password on database so how to solve this issue please public JsonResult…


Second value in dropdown list
<select class="form-select" asp-for="SpareParts.Item" asp-items="@(new SelectList(Model.Stocks,"ItemCode","ItemName"))"> <option value="">select...</option> </select>…


Another strange problem...
I am entering data into a table. During this (In the OnPostAsync scope), I do send an query to an another table, to obtain a missing data that doesn't is included in the data which comes the from. But at each try i get a strange rendered result. …

