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)

22 results in tag: orm

EF 6 - Cascade Delete on one to many without backreference

I have something like this:...public class Gadget { public int Id { get; set; } public string Name { get; set;} public int SuperHeroId { get; set; } } public class SuperHero { public int Id { get; set; } public virtual ICollection<Gadget> Gadge...
.net entity-framework entity-framework-6 entity-framework-mapping orm
asked by George Mauer

Two foreign keys with same Navigation Property?

I am new to Entity Framework so I don't know much about it. Currently I am working on My College Project, in that Project I came across a problem where I have two foreign keys refers to the Same column in another table. how can I handle this situation. ..
c# entity-framework entity-framework-4 entity-framework-6 orm
asked by Ankit Agrawal

Entity Framework 6 - inheritance and navigation properties on base class

I have a problem with navigation properties and inheritance....This is my problem: I have a base ...Person... class and classes ...User... and ...Worker... which inherit from ...Person.... On the DB level I'm using single table inheritance or table per hi...
c# entity-framework entity-framework-6 inheritance orm
asked by ZolaKt

Entity Framework proper way to replace collection in one to many

Suppose a customer has many phone numbers and a phone number has only one customer....public class PhoneNumber : IValueObject { public string Number {get; set;} public string Type {get; set;} } public class Customer : IEntity { public ICollection<...
c# entity-framework entity-framework-6 mapping orm
asked by George Mauer

Eager , Lazy and explicit loading in EF6

I have read this ...tutorial... and this ...article... but I don't understand exactly the use of each loading type....I Explain...I have this POCO :...public partial class dpc_gestion { public dpc_gestion() { this.ass_reunion_participant =...
c# entity-framework entity-framework-6 lazy-loading orm
asked by Lamloumi Afif

Mapping inheritance in EntityFramework Core

I'm using EntityFramework Core, Code First and Fluent Api to define model database, and i've follow situation about strategy of map inheritance:...public class Person { public int Id { get; set; } public string Name { get; set; } } public class U...
design-patterns ef-fluent-api entity-framework entity-framework-core orm
asked by Tainer Poletto

Can't auto-generate IDENTITY with AddRange in Entity Framework

I don't know if it's an Entity Framework's desing choice or a wrong approach on my behalf, but whenever I try to AddRange entities to a DbSet I can't seem to get the auto-generated IDENTITY fields....[Table("entities")] public class Entity { [Key] ...
c# commit entity-framework entity-framework-6 orm
asked by lucacelenza

Entity Framework : get all entities with specific type

I am using Entity Framework to read/write data to the DB and wondering if there is a way to get the entities by type. For example: I have ...Student... table and ...Classroom... table (in reality, I have bunch of tables). I would like to get all the stude...
c# database entity-framework entity-framework-6 orm
asked by Dilshod

Entity Framework Core: Update relation with Id only without extra call

I'm trying to figure out how to deal with 'Single navigation property case' described in ...this doc:...Let's say we have 2 models....class School { public ICollection<Child> Childrens {get; set;} ... } ...and ...class Child { public int Id {get...
asp.net-core c# entity-framework-core orm relationship
asked by silent_coder

Why am I getting a contentRootPath null exception when attempting to add a database migration in entityframework core?

I have a .NET Core class library that is the data access layer for multiple web applications. I am using Entity Framework Core 1.1, but I'm having trouble with migrations through PMC. My initial migration worked successfully, but after updating the databa...
.net c# entity-framework-core orm
asked by dzlp

Entity Framework Core commands is not recognized in Nuget PM

We are using EF6 and EF Core in the project at the same time. I have migration which was created by other team member. I want to Update database using next command:...EntityFrameworkCore\Update-Database...But the next error is occured:...EntityFrameworkCo...
asp.net-core c# entity-framework entity-framework-core orm
asked by Aram Petrosyan

Prevent Adding New Record on Related Table Entity in Entity Framework

I am trying to add new record on my entity. It works fine, the problem is, the related entities are adding new records as well. Is there a way to stop related or 2nd level entities to be inserting new records as well?...Here is my sample Entity Class:...p...
c# entity-framework entity-framework-6 orm
asked by Willy David Jr

Binding Complex Model Entity With Raw SQL Query?

I have been using entity framework quite some and I can do complex model binding with entity itself easily, but when it comes to raw sql binding I cant find any solutions that is doing complex binding of relation db....for example following is a entity to...
asp.net-mvc c# entity-framework entity-framework-6 orm
asked by Alok

EntityFramework: Database.CurrentTransaction becomes null when exception occurs

Today I faced strange issue with Entity Framework. Consider following class:...public partial class Entities { ... public void DocumentUpdateForSync(string userLogin, IEntrySync document) { var timeEntry = document as Domain.Documents.TimeEntry; ...
c# entity-framework entity-framework-4 entity-framework-6 orm
asked by Sergey

include only returning one row and not closing json

I'm having difficulty with my .NET Core Api 2.1....I set up a database in SQL Server 2017 and created my tables with all the proper conventions, FK's, PK's and so on....The tables are structured as follows:...Contacts:...namespace ContactsApi { public...
.net-core entity-framework-core orm rest sql-server
asked by Ryan Peterson Designs

Correct way of mapping a 'one to many' relationship. When having the same relation in multiple entities

Suppose the following structure of classes and relationships:...class Document { public List<Version> DocumentVersions { get; set; } // Other properties } class Register { public List<Version> RegisterVersions { get; set; } // Other prope...
c# entity-framework-core orm
asked by alecardv

Use multiple huge databases in one Entity Framework Core query with SQL Server?

I want to query multiple tables from different databases in one single query with 1 or 2 ...dbcontext.... I've been searching for some info, and it seems not easy to make it work perfectly. ...I need to make several queries with 5 or 6 tables from 3 or 4 ...
asp.net-core-2.2 c# entity-framework-core orm sql-server
asked by Noel Alejandro

How to update(by merging) edmx without override the model classes in asp.net mvc

I am developing an application in asp.net mvc. I use entity framework as ORM. I have a problem. To use javascript unobstrusive validation, I need to add annotation to model objects. For example; [Required], [EMailAddress]. But when we add something to the...
asp.net-mvc c# entity-framework entity-framework-6 orm
asked by user6172721

How to include derived property of type contained in a List

I've got a data context with a list of pipelines. I want to query one pipeline containing all its properties and sub-properties. One pipeline has got a list of stages. The base stage type is abstract. In the list, there can be stages of different child ty...
.net c# entity-framework entity-framework-6 orm
asked by egon-olsen

When using Entity Framework, should I set the navigation property or foreign key property, when setting the FK?

I have some code that looks like this:...var customer = dbcontext.Customers.Find(1); var order = new Order(); order.CustomerId = customer.Id; dbcontext.Orders.Add(order); dbcontext.SaveChanges(); ...Is it best practice to this or set the relationship by...
c# entity-framework entity-framework-core orm
asked by AD700

Page 1 of 2
  • 1
  • 2
  • ยป

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!