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

Entity Framework 6 - Knowledge Base (KB)

14 results in tag: fluent-interface

One-to-many code-first reference

I have the following two tables:...LOCALIZATION...Id int Text string ...DINER...Id int Name string Description string Name_LocalizationID int Description_LocationID ...
code-first entity entity-framework fluent-interface
asked by sadhat75

What is the difference between.WithMany() and.WithOptional()?

Below are two similar fluent API configurations:...WithMany()...modelBuilder.Entity<Country>() .HasRequired(cou => cou.Currency) .WithMany() .WillCascadeOnDelete(false); ...WithOptional()...modelBuilder.Entity<Country>...
ef-code-first entity-framework fluent-interface
asked by Ingmar

How to establish a one-to-many connection with default settings in EF Code First 4.1

I have a Customer entity which references a collection of Addresses. The complication here is that I want to be able to identify a particular address as the default address....If possible I would like to hold the FK of the default address in the Customer...
ef-code-first entity entity-framework fluent-interface
asked by P2l

How can I use the Entity Framework 4.1 "code only" fluent API to map a char property?

I have an object that has a char property:...public class Product { public char Code { get; set; } } ...Entity Framework doesn't seem to be able to map chars (this field is missing from the database when I create the database s...
char ef4-code-only entity-framework fluent-interface
asked by dommer

First, define the Foreign Key Entity Framework Code, then use Fluent Api.

I have a question about defining Foreign Key in EF Code First Fluent API. I have a scenario like this:...Two class Person and Car. In my scenario Car can have assign Person or not (one or zero relationship). Code:... public class Person { public i...
ef-code-first entity-framework fluent-interface foreign-keys
asked by patryko88

EF Code First prevent property mapping with Fluent API

I have a class ...Product... and a complex type ...AddressDetails...public class Product { public Guid Id { get; set; } public AddressDetails AddressDetails { get; set; } } public class AddressDetails { public string City { get; set; } p...
c# ef-code-first entity-framework fluent-interface
asked by Catalin

Mapping 2 tables to single entity in Entity Framework

I hope you can help me....I have 2 tables in the db: Bill and BillItem. These tables are configured with one to one relation in the db where bill is the principle table while BillItem is the dependent one...The structure of table Bill :...Int BillId (PK) ...
c# code-first ef-code-first entity-framework fluent-interface
asked by Shpongle

How to store double[] array to database with Entity Framework Code-First approach

How can I store an array of doubles to database using Entity Framework Code-First with no impact on the existing code and architecture design?...I've looked at Data Annotation and Fluent API, I've also considered converting the double array to a string of...
.net c# ef-code-first entity-framework fluent-interface
asked by jonas

The DELETE statement conflicted with the SAME TABLE REFERENCE constraint with Entity Framework

I have a table with a self reference where the ParentId is an FK to the ID (PK).... Using EF (code-first), I've set up my relationship as follows: ...this.HasOptional(t => t.ParentValue) .WithMany(t => t.ChildValues) .HasForeignKey(t => t.ParentId...
.net c# entity-framework fluent-interface sql-server
asked by Kon

EF Code First: Multiplicity constraint violation

HELP! - I am receiving the following error on my navigational model ...ArticleType...:...A relationship multiplicity constraint violation occurred...Here is the existing database schema:...Here is my code:...public class Article { public int ID { get;...
c# code-first entity-framework fluent-interface
asked by Yorro

EF6.0 "The relationship could not be changed because one or more of the foreign-key properties is non-nullable"

If I try to delete a "child" row I always get an exception. Here is a snipset:...using (var context = new CompanyContext()) { ItemType itemType = context.ItemTypes.FirstOrDefault(i => i.Name == "ServerType"); ItemTypeItem itemTypeItem = itemType.I...
entity-framework fluent-interface
asked by Max

Unable to determine the principal end of an association - Entity Framework Model First

I have created Entity Data Model in Visual Studio. Now I have file with SQL queries and C# classes generated from Model....Question:...Classes are generated without annotations or code behind (Fluent API). Is it OK? I tried to run my application but excep...
c# entity-framework fluent-interface
asked by Michal

Creating Unique Index with Entity Framework 6.1 fluent API

I have a column "Name" that must be unqiue. No foreign key or anything like that....EF 6.1 finally supports creating such indexes via Annotations. That has been discussed already on SO. But it seems it can only be done via annotations in the classes. How ...
.net c# entity-framework entity-framework-6 fluent-interface
asked by John

What is the proper usage of HasColumnType and Database generated

I'm migrating a substantial EF model of ~80 entites from EF4 to EF6, and I'm also changing it from a Designer EDMX-generated database, to a Code First database....Right now I'm configuring the entity relationships using EF fluent-api, and I'm not certain ...
c# entity-framework fluent-interface
asked by kpk47

Page 1 of 1
  • 1

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
Save your entities 20× faster with EF Extensions
SaveChanges vs BulkSaveChanges

EF Extensions
Try for free now
Get monthly updates by subscribing to our newsletter!
SUBSCRIBE!