zzz projects Entity Framework Core EF Core
Home Articles Knowledge Base Online Examples
  • Home
  • Articles
  • Knowledge Base
  • Online Examples

Entity Framework Core - Knowledge Base (KB)

6642 results

Cascade delete with DbContext and Entity Framework 6

Is there a way to cascade delete entities without modifying foreign keys in DB and without modifying edmx? I have DB with over 100 tables referenced using foreign keys with Delete Rule = No Action....I found this this beautiful code in "Entity Framework ...
.net entity-framework entity-framework-6
asked by Cherven

How can I use Entity Framework 6 and my repository to delete multiple records?

I am using Entity Framework 6 and I have a repository looking like the following with the Add and Update methods removed to make it shorter:... public class GenericRepository<T> : IRepository<T> where T : class { public GenericRepository(DbContext dbC...
asp.net-mvc entity-framework entity-framework-6
asked by user1943020

Getting a the new value of RowVersion using Entity Framework 6

Is is possible, to get the new value of RowVersion using the same DbContext, without reloading the entity from the database?...Scenario:...Load data into editor form...Save new values...The row in the table gets updated, new value of RowVersion is generat...
asp.net-mvc asp.net-mvc-5 entity-framework entity-framework-6
asked by Tadej Mali

Entity framework code first migration to multiple database

Lets say we have the architecture model of web application where we have 1 database per 1 account. Database structure is the same for these accounts and differs only on data with in. How can i configurate a migrations in code first model.
code-first ef-code-first ef-migrations entity-framework entity-framework-6
asked by Vitach

Why is ON DELETE SET NULL still not implemented in the Entity Framework 6? Is there a snag?

It still is not possible to configure a relation with the ON DELETE SET NULL rule using Entity Framework code first. As a workaround you have to load all the related entities in memory and ...then... on deletion of the parent entity EF will issue SQL comm...
ef-code-first entity-framework entity-framework-6
asked by Dabblernl

Can I use Entity Framework 6 with Visual Studio 2010?

Our development team (and build servers) successfully use a mixture of Visual Studio 2010 and Visual Studio 2012 for our application....However, since upgrading from EF5 to EF6, we no longer seem to be able to build with VS2010. Specifically, the build ma...
entity-framework entity-framework-6 visual-studio-2010
asked by Rob

How to unit test async methods of Entity Framework with a multiple clauses

I'm trying to unit test an async method in EF 6.0.2 with Moq 4.0.10827 and I'm getting blocked in what appears to be a casting issue....The following works fine:...public async Task<List<Testimonial>> GetByEventIdAsync(int eventId) { var query = from ...
c# entity-framework entity-framework-6 unit-testing
asked by Dan Friedman

How to map non-public Collection properties with Entity Framework Code First?

I am trying to map a collection of entities with a non-public property, so as to better encapsulate my domain, since the entity that contains the collection needs to enforce certain rules on the collection, e.g.... public class Foo { public AddBa...
c# entity-framework entity-framework-6
asked by Nathan

Entity framework optional 1 to 1 relation on both ends

Most questions I have found were not the type I am looking for....I have 2 tables:...public class User { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid UserId { get; set; } public Guid? CustomerId { get; set; } [F...
ef-code-first entity-framework entity-framework-6
asked by Roger Far

Entity Framework Enum and string association

I want to use the method in ...this article... to implement friendlier ToString() outputs for my enum types. I would like to know how this can be done in Entity Framework's auto generated Enum codes? Would I have to modify the code generation template (if...
c# entity-framework entity-framework-6
asked by thankyoussd

Two (almost) concurrent DbContexts causing problems: How to share between Controller and AuthorizeAttribute

Every once in a while, I'm encountering the following exception in my ASP.NET/MVC5/WebAPI2/EF6/MSSQL application:...System.InvalidOperationException: The context cannot be used while the model is being created. This exception may be thrown if the context ...
asp.net-mvc-5 concurrency dbcontext entity-framework entity-framework-6
asked by Alex

Schema specified is not valid. Errors: The relationship 'EntityA_EntityBs' was not loaded because the type 'EntityB' is not available

Background...I'm working on an application that uses Entity Framework to query a database from a third-party application. The database has a large number of tables and no foreign keys. I've mapped the relevant tables to entities using Entity Framework Flu...
.net entity-framework entity-framework-6
asked by Sam

Stored procedure has to many arguments specified entity framework

I'm using Entity Framework 6 with Stored Procedures mapping. I have an insert sp with 6 parameters for the insert. The entity that I insert has 8 properties where one property is the Id....The problem is that I get this error:...Procedure or function sp h...
entity-framework entity-framework-6 stored-procedures
asked by Ralph Jansen

Select records count from multiple tables in a single query

I have some models (restaurants, shops, products), and i want to select records count for multiple models in a single linq query....I know how it should be in sql, but i don't know how to translate it in linq:...select (select count(*) from restaurant...
c# entity-framework entity-framework-6 linq
asked by alexmac

How to group by DateTime.Date in EntityFramework

I have a device model:...public class DeviceModel { public DateTime Added { get;set; } } ...And i want to select devices count, grouped by ...Added... date (...not Date and Time, but only date...). My current implementation is not valid, because linq ...
c# entity-framework entity-framework-6 linq
asked by alexmac

Entity Framework 6 and output parameter

First time working with EF in general and wanted to call a stored procedure. So far I've added the stored procedure in a model (.edmx) and I believe that it's calling properly but I'm not sure how to add the output parameter. ...This is what the stored p...
c# entity-framework entity-framework-6 output stored-procedures
asked by Mike Stone

Creating indexes with Entity Framework 6 Migrations

Is there a way to create an index in MS SQL Server database using Entity Framework Code First Migrations, if the index has to be: ...descending by at least one column...including other columns...?...It has to produce something like this:...CREATE NONCLUST...
ef-code-first entity-framework entity-framework-6 indexing sql-server-2012
asked by Michael Sagalovich

EF6 Foreign Key Issue

Here are my models...public class Driver { public int Id { get; set; } public String Name { get; set; } public int VehicleId { get; set; } public virtual Vehicle Vehicle { get; set; } } public class Vehicle { public int Id { get; s...
entity-framework entity-framework-6
asked by Ashish Charan

Entity Framework map struct/complex type without model properties

I have a 'model ...struct...' which is internally a string, but is being used to somewhat similiar to a ...GUID.......public struct Token { private string _value; private Token(Guid uuid) { _value = Token.FromGuid(uuid); } publi...
c# entity-framework entity-framework-6 fluent
asked by Acrotygma

Entity Framework Code-First Migration Fails with SQL Server

Using Entity Framework 6 and SQL Server, I get the following error when EF is doing the migration thing:...Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending...
c# entity-framework entity-framework-6
asked by John Smith

Page 7 of 333
  • ««
  • «
  • …
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • …
  • »
  • »»

Prime Library

Performance

  • Entity Framework Extensions
  • Entity Framework Classic
  • Bulk Operations
  • Dapper Plus

Expression Evaluator

  • C# Eval Expression
  • SQL Eval Function
More Projects...

Related

  • EF Extensions Online Benchmark
  • WIN an EF Extensions license
  • EF6 BatchSaveChanges for only $79
Get monthly updates by subscribing to our newsletter!
SUBSCRIBE!