How to connect BlobTrigger Stream of an Sqlite file to Entity Framework Core?
I'm trying to setup an Azure Function in .NET 8 Isolated with a Blob Trigger to read/write to Sqlite files as they're uploaded to the blob. My issue currently, is I can't seem to figure out how to connect the Function's [BlobTrigger(~)] Stream stream…
How to use schema name in EF core autogenerated names?
Hi, I am migrating my project from EntityFramework to EntityFramework Core. What I noticed EF Core has different name convention. When I am generating new migration it is not including schema name. For example, let say Car class will have foreign key to…
entity frameowrk
hi iam using dotnet 6 iam new to dotnet can any one tell me is there any way to enable lazy loading for certain queries in dotnet6 s currently enabling globally working its not giving too much improvement in performance and memory use and and also want…
EF Core - How to Exclude a Certain Value Before it's Added to the Database
I would like to exclude two event IDs, 4703 and 5156 so they are not included in the .AddAsync to the Database. We do not need them and there are so many of them in the eventlog. What would be the best/effective way to do that? The event IDs are coming…
How to I get my Entity Framework Core DbContext to access it's Connection String from Azure Key Vault
Hello I am using the following code in my Program.cs file to successfully retrieve my connection string stored as a secret in Azure Key Vault (something I can see while debugging). The question I have, is how do I get this value securely to my classes…
Can you use an array inside of .Contains() via LINQ?
Please see the very bottom in the Answers section from me, I updated question down there rather than removing this here. A co-worker and myself wrote a very small app to store logs in a SQL database for 6 months. I'd like to add filtering parameters to…
Delete a record with the primary key
Hi; Is there a way to delete a record by its primary key? Yes I know I can do the following: using (var context = new MyDbContext()) { var entity = context.MyEntity.Find(id); context.MyEntity.Remove(entity); context.SaveChanges(); } But I…
enabling lazy loading for only one query but enabling it enables it for full class as it has only one dbcontext i have set lazy loading globallly false iwant it to work for only one query in dotnet 6
#region Dummy Usings using DummyNamespace1; using DummyNamespace2; using DummyNamespace3; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; #endregion namespace DummyNamespace4 { [UsedImplicitly] public…
how to enable lazy loading in dotnet6 for certaion queries as enabling it gloablly intruduces n+1 problem and
hi i am new to dotnet6 pls let me kow how to enable lazy loading in dotnet6 for certaion queries as enabling it gloablly intruduces n+1 problem and reduces performance and iwant thisto enables for certain scenarios
What approach should be taken to track changes in database operations in other windows?
Hello I continue to develop an application by injecting services with the MVVM pattern in a C# wpf project. I encountered a problem. I designed a DataAccess class to manage database operations (Insert, delete) with EF. A new record is added in a window…
Does Timed Trigger Azure Function in Isolated Process support identity-based sql connection for EF6
Hi! So I have a simple .NET6 Azure Function (v4) isolated process with TimerTrigger which connect to an Azure SQL database with Entity Framework. The problem is that it can't connect to the database using managed identity the same way I did for Azure App…
How to use Scaffold-DbContext in .NET Core for SQL Server Compact (*.sdf File) database
I'm using .NET Core Version 7 and I want to use EF Core to access a SQL Server Compact (*.sdf) database file. What libraries to use and how to use Scaffold-DbContext to build the existing database models and also the database has a password. I want to…
Memory is not releasing in dotnet6
I'm currently working on a .NET 6 Web API project, and I'm facing an issue with memory not being released properly. I have thoroughly analyzed the code and ensured that I'm not creating any memory leaks or holding onto unnecessary resources. However,…
EF Reverse Engineering can't handle " #" in column name.
I have a database that uses two different fields: string "Asset int "Asset #" After running EF Reverse Engineering on the existing database, it creates a model with: [Column("Asset")] public string Asset {…
How to pass model's nullable date format data to the view in editable form? problem is when i use input type and use value="" this does not display the datepicker if date is null and if i use this;@Html.TextBoxFor(model => model.ValidFrom, "{0:MM/dd/yyy;
problem is when i use <input class="form-control" value="@(Model.ValidFrom)" name="ValidFrom"> this does not display the datepicker if existing value of date is null and if i use this; @Html.TextBoxFor(model =>…
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…
How can I get an IUpdateEntry from a DbContext for a object that is read?
Hi all; I need to create a DbUpdateConcurrencyException and pass it the IUpdateEntry for the object I just had returned by dbContext.Events.FirstOrDefaultAsync(e => e.Id == entity.Id) I am throwing it if the rowversion has been updated over the value…
How do I create an optional 1:1 relationship in EF Core where neither side is dependent on the other?
I have a Device model, and a Tid model. Devices and TIDs can exist independently of each other, or can be associated together. If associated, then exactly one device can be associated with exactly one TID. For this I need a nullable one-to-one…
EF Core .Net 8 error after TLS 1.0 was disabled.
The admins where I work have disabled TLS 1.0 but now all of a sudden, my .Net 8 app is getting the following error: Microsoft.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred…
Getting an error :Add-Migration : The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Tried trouble shooting , verfied DB context class. Reinstalled Vs after troubleshooting and getting answers saying there is a problem with package manager .