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


EF Core 6 - Auto increment Identity primary key problem
Hi, I have had a Blazor Server application running on production for a while. There is an Orders table, user can insert records. USE [InventoryManagement] GO /****** Object: Table [dbo].[Orders] Script Date: 9.01.2023 14:37:29 ******/ …


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…


Blazor Server IHttpContextAccessor returning null when deployed
I am dynamically setting the connection string based on the user that is logged in. This is working perfectly when running locally/debugging but when its deployed it's returning a null reference exception. This is my DbContext and I am handling the…


Identity userManager.FindByNameAsync() returns null value
I'm upgrading an old project in asp .net 5 to asp .net 7 and when i try to use userManager.FindByNameAsync() it returns the following exception in the API Response : System.Data.SqlTypes.SqlNullValueException: Data is Null. This method or property cannot…


EF Core 6 - DateTime how to set null
Hi, I am trying to set null to a datetime field but unfortunately it is not setting null. public async Task UpdateOrderDetailAsync(OrderDetail orderDetail) { var detail = await…


ASP.NET Core Web API - DateTime Data Annotations Compare dates?
Hello, When the request is made, is there a way to compare with data annotations if the start date is smaller than the end date? Thank you. public class OrderHistoryRequestDto { [Required(ErrorMessage = "Please add…
Manage Nuget Packages give Object Reference not set to an instance of an object on Scaffolding
Getting the Object Reference not set to an instance of an object when trying to do scaffolding on a asp.net core mvc project i am working on. I already did the scaffolding when i started the project and now i have updated the database and and i need to…


ASP.NET Core Web API - DateTime Data Annotations Problem
Hello, I am trying to validate an API action method that has a start date and an end date. public class OrderHistoryRequestDto { [Required(ErrorMessage = "Please add StartDate to the request.")] …
What is the problem I have in my project
I SEE THIS ERROR my dbContext : using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using System.Reflection.Metadata; using RepositoryPattern.Models; namespace RepositoryPattern.Data { …
Does ShardMap support Microsoft.Data.SqlClient package ?
I have an .net core 6.0 entityframework application and want to connect to SQL Database through Azure Active Directory from the application. The code to connect to SQL Database through Azure Active Directory uses Microsoft.Data.SqlClient as the package.…


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


EF core, apicontroller validation
Hi all Can someone tell me how validation works with ef core in a webapi controller? I have tried data annotations. They work, but I need additional validation. I tried making metadata classes but they just don’t seem to work. Is there a new…


When Extend IdentityUserRole and add migration it create the AspNetUserRole table again
Iam trying to extend the IdentityUserRole entity but when i add migration it recreating the AspNetUserRoles table with the foreign keys also my extend entity: public class ApplicationUserRole: IdentityUserRole<string> { public…


VB 2022 & Entity Framework Core Examples
Why I can't find information, document and/or complete examples how to use (configuration, especially with XAML) Visual Basic 2022 with Entity Framework Core on Microsoft web site ? Is somebody have link to find (or a book. But not a general book. I…


Error: Introducing FOREIGN KEY constraint
Hi everyone! I have been trying to set up a backend system with dotnet and ran into an issue. Hope you guys could help me here. This is the situation: There are projects, each can have multiple tasks. Tasks can have multiple steps and…

