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)

35 results in tag: code-first

Can't update database using EF Migrations after updating to EF 6.0.0-alpha

After updating my Entity Framework to version 6.0.0-alpha1 I cant update database. This is the error I'm getting:...PM> update-database -verbose Using StartUp project 'DataCenter'. Using NuGet project 'DataCenter.Domain'. Specify the '-Verbose' flag to vi...
code-first ef-migrations entity-framework entity-framework-6
asked by Mahmoodvcs

How do I remove underscore of foreign key fields in code first by convention

I've got multiple classes (including TPT) in my project. Each POCO has a ...BaseClass..., which has a ...GUID... (called ...GlobalKey...) as primary key....First I used ...DataAnnotations... to create correct foreign keys. But then I've got problems synch...
code-first entity-framework entity-framework-6 naming-conventions
asked by Andreas Geier

EF6, Code-First, enable-migrations, "Unable to load the specified metadata resource"

I have created a C# class library with 3 entity classes and a DbContext for code-first generation of database. All has gone well with version 1. I have created a separate test library and the class library with the DbContext class has been behaving as e...
code-first ef-migrations entity-framework entity-framework-6
asked by Neil W

Code First Mapping to Database Views

I have been asked to map the ASP.NET Identity classes to existing database Views for read operations, using Stored Procedures for CRUD. There are a number of StackOverflow Questions stating that ...is possible to map to views..., also ...this question...,...
asp.net code-first entity-framework entity-framework-6
asked by pwdst

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

Multiplicity constraint violated. The role Child_Parent_Target of the relationship Child_Parent has multiplicity 1 or 0..1

I did a lot of research but haven't found any answer that matches my problem. I even tried to use the ...The relationship could not be changed because one or more of the foreign-key properties is non-nullable... example. No success....I'm working with Ent...
c# code-first entity-framework entity-framework-6 sql-server-2008
asked by Marco Alves

Entity Framework 6 One-Way relationship using Code First

I have the following scenario:...Color Class...public int ID { get; set; } public string Name { get; set; } public string Hex { get; set; } ...Widget Class...public int ID { get; set; } public int HeaderBackgroundColorID...
code-first ef-code-first entity-framework entity-framework-6
asked by kob490

Creating a database with EF6 SQL Server CE Code First crashing

I am seeing this error when I run my app...[MissingMethodException: Method not found: 'System.Data.Entity.Infrastructure.Interception.DbConnectionDispatcher System.Data.Entity.Infrastructure.Interception.DbDispatchers.get_Connection()'.] System.Data.En...
code-first dbcontext entity-framework entity-framework-6 sql-server-ce
asked by Sonic Soul

How to execute a stored procedure without returning results in Entity Framework 6?

I have a stored procedure like this:...CREATE PROCEDURE InsertTest(@p1 NVARCHAR(50) , @p2 INT) AS BEGIN INSERT INTO dbo.Test(Name, Code) VALUES ( N'', 0) END ...or other ...I try with this code:...context.Database.SqlQuery<int>("InsertTest @p1 , @...
code-first entity-framework entity-framework-6 sql-server-2008 stored-procedures
asked by ramin_rp

NullReferenceException in EF 5-6.1.1 with two navigation properties to the same type

I'd like to start with that I have a workaround for this issue - but I spent a few hours today figuring out the cause of the exception, so I'd thought I'd share...Given two entities in the domain:...public class User { public int Id { get; set; } ...
c# code-first entity-framework entity-framework-5 entity-framework-6
asked by Matt V

auto update code first from database model, is it possible?

I have code first classes which are generated from my existing db using ADO.NET Entity Data Model. Now I've added some new tables to the database. ...I want to know if its possible to create associated code classes from the new db tables without (re)creat...
code-first ef-code-first entity-framework entity-framework-5 entity-framework-6
asked by Laziale

Entity Framework Code First Fluent API configuration for one to one identifying relationship

I have the following class structure:...How to configure Fluent API to put identifying relationship in Cards table? ...I mean ...Cards Table PK: Id, CustomerId...Cards Table FK: CustomerId...I would like the previous Card be deleted when I assign a new on...
c# code-first ef-fluent-api entity-framework entity-framework-6
asked by Dmitry Nogin

EntityFramework CodeFirst: CASCADE DELETE for same table many-to-many relationship

I have an entry removal problem with the EntityFramework and a many-to-many relationship for the same entity. Consider this simple example:...Entity:...public class UserEntity { // ... public virtual Collection<UserEntity> Friends { get; set; } } ...
c# code-first ef-code-first entity-framework entity-framework-6
asked by tenbits

Column names in each table must be unique. Column name 'StripeRecipientId' in table 'dbo.Foos' is specified more than once

I have a model class named ...Foo... that has, among others, these properties....public string StripeRecipientId { get; set; } public override bool HasProvidedBillingInformation { get { // return !string.IsNullOrEmpty(this.StripeRecipient...
code-first entity-framework entity-framework-6
asked by Water Cooler v2

EF Code First Foreign key must be mapped to some AssociationSet or EntitySets participating in a foreign key association on the conceptual side

we want to migrate our project from Database-First to Code-First. For this task i used the Code First from database Generator from Visual Studio. I have some tables with concatenated PKs and FKs. I cannot change them to one simple "ID", because there is a...
c# code-first ef-code-first entity-framework entity-framework-6
asked by wertzui

EF - Code First approach: connection string and initializer are not being picked from app.config file

I have a class library project where I have created entities, and context for Entity Framework. I have also created an initializer to seed default data in the database....Following is the app.config file of the class library project - ...<?xml version="1....
app-config code-first entity-framework entity-framework-6 sql-server
asked by Nirman

How to specify Unique Key in EF 7 Code First with Data Annotations

You can specified a Unique Key with Fluent Api:...public class MyContext : DbContext { public DbSet<User> Users { get; set; } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity<User>() ...
code-first data-annotations entity-framework entity-framework-core
asked by Ruben Perez

Entity Framework 6 Code First VarBinary Length in mapping or computed column

I see it is possible to use a query to find a length of a varbinary field in a query....Entity framework and VARBINARY...But can you map a FileSize property to get the size of a varbinary in the Fluent API without having to write queries?...I want to be a...
code-first ef-fluent-api entity-framework entity-framework-6 sql-server
asked by Andez

Entity Framework Core Code-First: Cascade delete on a many-to-many relationship

I'm working on an ASP.NET MVC 6 project with Entity-Framework Core (version ..."EntityFramework.Core": "7.0.0-rc1-final"...) backed by a SQL Server 2012 express DB....I need to model a many-to-many relationship between a ...Person... entity and an ...Addr...
c# code-first ef-code-first entity-framework entity-framework-core
asked by m.phobos

Entity Framework: Foreign Key in code first

What is wrong in my code that i get below error:...Unable to determine a valid ordering for dependent operations. Dependencies may exist due to foreign key constraints, model requirements, or store-generated values...Code:...Class Food:...public class Foo...
c# code-first entity-framework entity-framework-6 foreign-keys
asked by Ali Mottaghi Pour

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!