Content
How to use EF Core when two properties in the Principle entity point to the same attribute in the dependent entity?
I have 2 Model classes: Department.cs cs public class Department { public string DepartmentId { get; set; } public string Name { get; set; } public string Description { get; set; } [ForeignKey("FacultyId")] public…


Inject EntityFramework DbContext in a .NET 6 Azure Function
Where do I have to put the DbContext in a .NET 6 Azure Function? builder.Services.AddDbContext<DataContext>(options => // options.UseSqlServer(context.Configuration.GetConnectionString("BlazorOrderApp"))); There is…


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>…


Stored Procedures returning null value in razor pages
Hi, i have two stored procedures which will execute based on the condition. First Stored Procedure : AvailableHourSlots CREATE PROCEDURE [dbo].[AvailableHourSlots] @ActivityName nvarchar(max) , @BookedDate datetime2(7) AS SELECT distinct…


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…


EF Core 6 - Truncate Table
Hi, How can I use the truncate table in EF Core 6? I tried this but didn't delete rows. _oyunPalasContext.RazerReconciliation.FromSqlRaw("TRUNCATE TABLE RazerReconciliation");


Blazor Server - System.InvalidCastException: Unable to cast object of type 'System.Double' to type 'System.Single'.
Hi, In my Blazor server application, I am trying to get the records from RazerReconciliation table as follows. I couldn't figure out why I am getting this error. public async Task<List<RazerReconciliations>> GetOldReconsAsync() { var…
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


Entity Framework Core can't create migrations table using created login
I am doing a some training with .Net 6.0, C# and Entity Framework Core. I got to the point that EF can generate a new migration but hen I run dotnet ef database update I am getting an error: Failed executing DbCommand (38ms) [Parameters=[],…
SQLAzure is not available for your selection of subscription and location
Hi Folks, Trying to use Azure for the first time, I'm using a normal account (i.e not free tier or student) but it is just for a hobby project. I'm following the tutorial here in order to deploy my EFCore webapi…


Scaffold-DbContext probleme authentication integrated security
Hello I want scaffolding my azure sqserver database, but when i run this command : Scaffold-DbContext "Server=MydataBase.database.windows.net;Database=dev-base;Integrated security=true;Authentication=Active Directory Integratd;User…
JSON Format WebAPI Entity Framework
Currently the JSON I'm using looks like this: The JSON file is huge so I'm only showing the first few rows in the file so not all data is shown. I'd like to get this JSON structured so I can use in a TreeView menu so I'd like to see get the out put to…
Porting Entity Framework 6 to Entity Framework Core
I am porting an application from ASP.net MVC 5 to ASP.net Core MVC and I reach out in the area pointing the Entity Framework related modules. I have the generated classes and I also have the edmx and tt files, I added the files to a newly created Class…


CreateFunction Like
Hi, I need an example about CreateFunction for like Could you give me an example ? https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/user-defined-functions


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; } …


SQL Bulk Insert Problem while inserting excel data
Hi guys, In my Blazor Server application, I am trying to insert excel data into a SQL database table. I am getting this error, but couldn't figure out why. Hope you can help me. Error: The given ColumnName 'PID' does not match up with any column in data…
EF Core 6 Adding a table manually?
Hello friends, I am working on a web API project that I implemented with the code-first approach. I wonder if there is a problem creating tables manually without using migrations. Does it cause any problems? Thank you.
Blazor Server - SQLBulkCopy Excel data into SQL Server table
Hello folks, I am working on a Blazor server application. There is a requirement to insert excel data (approx. 200000 records) into a table. Is there any tutorial that I can follow? Thank you.
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 …

