Questions tagged [entity-framework-core]
For questions about Entity Framework Core (EF Core) for .NET Core. Please also add a version-specific [ef-core-xx] tag, when applicable. Note that Entity Framework for .NET Framework is an older, different product that fits the [entity-framework] tag.
entity-framework-core
22,757
questions
26
votes
1
answer
19k
views
How to create a many to many relationship with latest nightly builds of EF Core?
How do you use the Fluent API to create a many to many relationship between two tables in EF7 EF Core? For example, say you have the following tables:
How would one leverage the modelBuilder in the ...
3
votes
1
answer
7k
views
How to run dynamic SQL query in Entity Framework 7 that auto-maps to Entities (SqlQuery<T>)?
I have an existing app that I am trying to upgrade from MVC5/EF6 to MVC6/EF7. We dynamically create some of our SQL tables, and as a result, have made use of the
System.Data.Entity.Database.SqlQuery
...
1
vote
2
answers
182
views
ASP.NET 5 app hosted on Ubuntu won't access Azure SQL database
ASP.NET 5 app works normally on IIS and allows adding anything to database on Azure SQL Server. With same connection string, while hosted on Ubuntu , it seams it can't access database. No exception is ...
1
vote
2
answers
3k
views
EF7 commands do not work in VS2015 CTP 6
I'm trying to run ef7 migration on fresh asp.net 5 preview project.
Steps I took:
Created fresh project based on template "ASP.NET 5 preview starter web"
Build it
Try command Add-Migration in Package ...
58
votes
4
answers
24k
views
Is there an Entity Framework 7 Database-First POCO Generator?
I've been playing around with Entity Framework 7 and ASP.NET 5 for a new project I'm working on, but I've hit a roadblock. The team I'm working on uses a DBA-first approach to development; i.e. the ...
3
votes
1
answer
330
views
Using Include that produces no result will close the reader
I am using EF7 beta3.
When executing two queries on my database, if the first query returns no result and has an include, the second query will fail with a System.InvalidOperationException. I am ...
28
votes
8
answers
68k
views
How do you configure the DbContext when creating Migrations in Entity Framework Core?
Is there way that dependency injection can be configured/bootstrapped when using Entity Framework's migration commands?
Entity Framework Core supports dependency injection for DbContext subclasses. ...
0
votes
4
answers
6k
views
Configure more than one dbcontext in EF 7
I created a web starter application with VS 2015 ctp, and I would like to add an in-memory store to do some test, but when I try to read the data, I get this message
The data stores '...
47
votes
11
answers
19k
views
DbSet doesn't have a Find method in EF7
I am trying to create a generic repository to access my database. In EF6 I was able to do that in order to get a specific entity:
protected IDbSet<T> dbset;
public T Get(object id)
{
...
7
votes
3
answers
2k
views
ASP vNext and PostgreSql
exists currently any way, how to communicate with PostgreSql database, when I want to use ASP.NET vNext? I'm looking for solution, which will work mainly on linux.
EF7 supports only MS SQL a SqlLite ...
0
votes
0
answers
832
views
Projections in EF7
I'm try to do the following simple projection in Entity Framework 7 and getting the error:
System.InvalidOperationException was unhandled by user code
HResult=-2146233079
Message=When called ...
4
votes
2
answers
2k
views
How handle these two models in code first approach using Entity Framework 7?
Problem
I am coding proof of concept ASP.NET 5 MVC6 that will simulate a library. I am using CTP6 and beta3.
How to define their relationship in Entity Framework 7 using code first approach?
...
7
votes
1
answer
979
views
ASP.NET MVC 6 - Assigning NOT NULL to the Primary Key in Entity Framework 7
Code:
migrationBuilder.AddPrimaryKey("AspNetRoles", "PK_AspNetRoles", new[] { "Id" }, isClustered: true);
I am getting the error message as Cannot define PRIMARY KEY constraint on nullable column in ...
2
votes
1
answer
2k
views
Asp.Net MVC 6 - A relational store has been configured without specifying either the DbConnection or connection string to use
I am running the EF migrations from the command prompt.
I am getting the error message as "system.invalidoperationexception: A relational store has been configured without specifying either the ...
1
vote
2
answers
372
views
Unable to set the current stack frame
I opened the command window in Visual Studio 2015 CTP and given the following command
>k ef migration add [migration name]
>k ef migration apply
It is giving the response message as Unable to ...