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)

41 results in tag: foreign-keys

Entity Framework EntityKey / Foreign Key problem

As the result of a form post, I'm trying to save a new Brand record. In my view, Gender is a dropdown, returning an Integer, which is populated from ViewData("gender")...I've setup my link as follows:...gID = CInt(Request.Form("Gender")) Brand.GenderRefer...
entity entity-framework entitykey foreign-keys
asked by Squiggs.

Adding & Updating Foreign key in Entity Framework v1

I'm using .NET 3.5 SP1. I created entity 'Category', based on table 'category_table' and 'MyUser', based on table 'App_User_table'. ...CREATE TABLE category_table ( catg_id int, catg_name varchar(50), catg_description varchar(250) ) CREATE TABLE App...
entity-framework foreign-keys
asked by dev

Entity Framework Updating with Related Entity

I'm using the EF to try to update an entity with ASP.NET. I'm creating an entity, setting it's properties then passing it back to the EF on a separate layer with the ID so the change can be applied. I'm doing this because I only store the ID of the entity...
asp.net entity-framework foreign-keys
asked by Echilon

Exception about foreign key

Here is the inner exception: ...InnerException: System.Data.UpdateException Message=Entities in 'OrganizerDBEntities.Assignments' participate in the 'CourseId' relationship. 0 related 'Course' were found. 1 'Course' is expected.` ...I have three tabl...
c# entity-framework foreign-keys xamlparseexception
asked by Mohit Deshpande

Entity Framework - Insert with foreign key

Apologies if there is clear answer for this somewhere. But I can't insert into a simple table due to it containing a foreign key....Task Table...TaskId (PK) ...Description ...StatusId (FK)...Into which I try to insert like so:... Task t = new Task(...
c# entity-framework foreign-keys insert-update
asked by Dan Black

Entity Framework 4 Databinding on WinForms ComboBoxes with Foreign Keys

I am using Entity Framework 4, I need to get WinForms to bind Customers and Quotes as a Master - Detail relationship....I have a Quote table which I lay out as details view on a Windows Form....The quote table has 3 foreign keys to the customer table. (fi...
c# combobox entity-framework foreign-keys
asked by Andrew Roberts

composite key as foreign key

I am using Entity framework 4.1 in MVC 3 application. I have an entity where I have primary key consists of two columns ( composite key). And this is being used in another entity as foreign key. How to create the relationship ? In normal scnerios we use :...
c# composite-key ef-code-first entity-framework foreign-keys
asked by DotnetSparrow

Entity Framework Code first - FOREIGN KEY constraint problem

I'm new to EF code first principal and currently with no clue what to do.. I have 2 POCO classes.....public class Problem { public int ProblemID { get; set; } public int UserID { get; set; } public int CategoryID { get; set; } public int R...
cascade ef-code-first entity-framework foreign-keys
asked by rjovic

Entity Framework on delete cascade

I have problem with deleting related rows in Entity Framework 4.1. I have tables with relations...Book 1<--->* BookFormats...I have set the on delete cascade:...ALTER TABLE [dbo].[BookFormats] WITH CHECK ADD CONSTRAINT [FK_BookFormats_Book] FOREIGN KE...
c# cascading-deletes entity-framework foreign-keys
asked by Tony

EF4.1 Code First : How to disable delete cascade for a relationship without navigation property in dependent entity

Let's say I have these two very basic entities:...public class ParentEntity { public int Id; public virtual ICollection<ChildEntity> Childrens; } public class ChildEntity { public int Id; public int ParentEntityId; // Foreign Key public vi...
c# cascading-deletes ef-code-first entity-framework foreign-keys
asked by darkey

Specifying Foreign Key Entity Framework Code First, 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

entity object cannot be referenced by multiple instances of IEntityChangeTracker. while adding related objects to entity in Entity Framework 4.1

I am trying to save Employee details, which has references with City. But everytime I try to save my contact, which is validated I get the exception ..."ADO.Net Entity Framework An entity object cannot be referenced by multiple instances of IEntityChangeT...
ado.net asp.net c# entity-framework foreign-keys
asked by Smily

EF One-to-many Foreign Keys without child navigation properties

Using code-first Entity Framework and .NET 4, I'm trying to create a one-to-many relationship between parents to children:...public class Parent { [Key] public int ParentId { get; set; } [Required] public string ParentName { get; set; } ...
c# code-first entity-framework foreign-keys
asked by Arithmomaniac

Specify ON DELETE NO ACTION in ASP.NET MVC 4 C# Code First

How do I specify ON DELETE NO ACTION Foreign Key Constraint in my model designs?...At present, I have:...public class Status { [Required] public int StatusId { get; set; } [Required] [DisplayName("Status")] public string Name { get; s...
asp.net-mvc c# code-first entity-framework foreign-keys
asked by Gravy

adding a foreign key with Code First migration

I have an error when trying to update my database after adding a migration....Here are my classes before add-migration...public class Product { public Product() { } public int ProductId { get; set; } public string Name { get; set; } publ...
ef-migrations entity-framework foreign-keys
asked by user1714324

Problems creating a Foreign-Key relationship on Entity Framework

i'm having trouble configuring a foreign key relationship in my Entity Framework fluent Api:...Here is the head of the report:... public class Testata { public Testata() { Details = new List<Dettaglio>(); } public virtual int IDTEST { get; set; } ...
.net c# ef-code-first entity-framework foreign-keys
asked by user2541621

Entity Framework DELETE statement conflicted with the REFERENCE constraint

I’m pretty new to EF and I have a little problem....I just want to delete an item in my database. I’m using SQL Server 2012 Express, VS2012, AdventureWorks 2012. ...The query that I execute is the following:...context = new AWEntities(); v...
cascade entity-framework foreign-keys
asked by user2675973

Duplicate navigation properties when using Entity Framework 6 and fluent api

I got two models with a relations....public class Customer { public Customer() { CustomerSites = new List<CustomerSite>(); } public IList<CustomerSite> CustomerSites { get; set; } } public class CustomerSite { public Gui...
c# entity-framework entity-framework-6 fluent foreign-keys
asked by ainteger

Relationships in Entity Framework Code First

yesterday I created database in Management Studio and now I want to create it in program using EF Code First....Here is link to my database: ...http://s11.postimg.org/6sv6cucgj/1462037_646961388683482_1557326399_n.jpg...And what I did: ...public class Gam...
c# code-first entity-framework foreign-keys
asked by Remi

Understanding ForeignKey attribute in entity framework code first

See the following post for some background:...Entity framework one to zero or one relationship without navigation property...I had always thought that ...ForeignKey... was used to show which property in a class held the ForeignKey that determined the navi...
c# code-first entity-framework foreign-keys shared-primary-key
asked by Mark007

Page 1 of 3
  • 1
  • 2
  • 3
  • »

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!