Category "entity-framework"

A fatal error occurred. The required library libhostfxr.dylib could not be found

I'm working on ASP.NET Project with .NET 5.0. For Database creation, I've run the command dotnet tool install --global dotnet-ef After the installing, when I

Dynamic Search Using Entity Framework

I have a search screen with optional fields using Entity Framework, I want to build a dynamic query without selecting the object and filter on it. I want to Op

Entity Framework Core: load related data after object is queried

It is clear how to query an entity and include all the related data; e.g.: using (var context = new BloggingContext()) { var blogs = context.Blogs .

What is the best way to perform partial updates in EF core and never update certain properties?

I know you can do something like var myObj = _db.MyTable.FirstOrDefault(x=>x.Id==id) and then update myObj property by property that you want to update but i

The instance of entity type cannot be tracked because another instance of this type with the same key is already being tracked

I have a Service Object Update public bool Update(object original, object modified) { var originalClient = (Client)original; var modifiedClient = (Cli

SQL Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding

I am using Microsoft.EntityFrameworkCore.SqlServer 2.2.6. I have a stored procedure which typically takes 1 to 2 seconds to execute. I am using .NET Core 2.2 wi

'Nullable object must have a value.' for List in LINQ c#

In database I have next model tblWorkItem with next field: public List<xWorkItemItemFailReason> WorkItemItemFailReasons { get; set; } When I am trying

Adding a New Column to an Existing Table in Entity Framework

I have added a new column to a table in my database. The table is already defined in the existing Entity Framework model. I've been through most of the items he

Cast IQueryable<DomainModel> to IQueryable<EntityModel> for EntityFramework

I'm trying to convert an IQueryable to IQueryable to allow me to take advantage of the dynamic filtering offered by Linq in the EntityFramework context. I'm try

Why doesn't scaffolding work as expected?

I am trying to scaffold and I get the following error: There was an error running the selected code generator: 'No parameterless constructor defined for typ

How to get all DbSet from DbContext

I need to get all tables in the database using EF. I need them to go table by table and extract certain information from each. Any idea how?

Entity Migration. Could not drop constraint. See previous errors

Here is the code that produce this error. I've tried solution for renaming the AddForeignKey but the error is same. 'PK_dbo.Item' is not a constraint. Co

How to Bulk Update records in Entity Framework?

I am trying to bulk update records using Entity Framework. I have tried Entity Framework.Extensions Update method. The Update method is able to bulk update for

scaffold-DbContext , command results in exception: System.Reflection.TargetInvocationException

When attempted to run a scaffold command I am now receieving the exception noted below. It may be important to note that this stopped working all of a sudden. C

Entity type ‘Business_attrib2object’ has composite primary key defined with data annotations. To set composite primary key, use fluent API

I set composite primary key using fluent API, it is still an error, when I'm trying to create ClassesController (MVC Controller with Views Using Entity Framewor

.Error CS1061 'Task<IEnumerable>' does not contain a definition for 'Where' and no accessible extension method 'Where'

My generic repository is as follows ( I have similar in synchronious and it works) public virtual async Task<IEnumerable<TEntity>> GetAsyn( Expr

Entity Framework Core multiple connection strings on same DBContext?

I have an Asp.Net Core app with Entity Framework Core that I initialize as follows: services.AddDbContext<ApplicationDbContext>(options => o

Table 'tblCustomer' does not have the identity property. Cannot perform SET operation

Occurs when I try to set the identity_insert to ON in the SQL DATAMANAGEMENT STUDIO. The worst is I do not know why should I deal with this value, and I am not

Entity Framework : Value cannot be null. Parameter name: type

When I execute update-database command, it shows this error message System.ArgumentNullException: Value cannot be null. Parameter name: type at Sy

Oracle V$SESSION Machine is <ComputerName>\<ComputerName> instead of <Domain>/<ComputerName>

I've a strange behavior with oracle and it's seems it causes problem with Security Policies. When I look the V$Session table, some connection "MACHINE" are only