entity-framework

What is a correct way to select a property of optional navigation property in Entity Framework?

扶醉桌前 提交于 2020-03-25 16:12:53
问题 What is a correct way to select a property of optional navigation property entity framework? I am concerned that in case the navigation property will be null, then the error will be thrown when I try to access its (optional navigation property`s) property. Here is what I tried: return await this

Define Entity Framework relationships using foreign keys only by FluentAPI

三世轮回 提交于 2020-03-19 07:58:15
问题 Is any way of defining Entity Framework relations using foreign keys only (no virtual properties of reference type) with FluentAPI (data models should not be changed)? CardDataModel public class CardDataModel { public int CardId { get; set; } } CheckItemDataModel public class CheckItemDataModel {

Entity Framework 6 DbSet AddRange vs IDbSet Add - How Can AddRange be so much faster?

我是研究僧i 提交于 2020-03-18 11:27:39
问题 I was playing around with Entity Framework 6 on my home computer and decided to try out inserting a fairly large amount of rows, around 430k. My first try looked like this, yes I know it can be better but it was for research anyway: var watch = System.Diagnostics.Stopwatch.StartNew(); foreach

Entity Framework 6 DbSet AddRange vs IDbSet Add - How Can AddRange be so much faster?

北城以北 提交于 2020-03-18 11:27:12
问题 I was playing around with Entity Framework 6 on my home computer and decided to try out inserting a fairly large amount of rows, around 430k. My first try looked like this, yes I know it can be better but it was for research anyway: var watch = System.Diagnostics.Stopwatch.StartNew(); foreach