Questions tagged [database-first]

171 questions
2
votes
2 answers

EF core Scaffold-DbContext doesn't work : Execution Timeout Expired

I'm trying to scaffold Models from an existing database. Scaffold-DbContext "connectionString" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models But I got this error: Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout…
2
votes
1 answer

EF 4.1 Code First with Existing Database

I have an existing DB and I have used the EF 4.1 code first to map my POCO objects to the tables. But I get the this error: EF 4.1 Error Model compatibility cannot be checked because the EdmMetadata type Eventhough I have added the…
Shuaib
  • 1,561
  • 3
  • 19
  • 28
2
votes
1 answer

Entity Framework 4.1 Code First - How to map a string containing csv of Entity ID's (foreign keys) to the corresponding Entity

Before I submit my question, please be aware that I'm working with an existing database owned by a third party vendor, so unfortunately changing the database format is not an option. Here's the issue: I have an Entity mapped to a database table that…
justin4now
  • 21
  • 1
2
votes
1 answer

EF4 DB-first: TPH approach?

I know this should not be trivial, but so far couldn't find the resolution... Working with an EF4 DB-First model, using LINQ-to-Entities with POCOs which will be consumed by an MVC3 app. I have three entities Customer, CustomerAdress and a lookup…
2
votes
0 answers

How to exclude some column from .edmx file, *.csdl ,*.msdl, and *.ssdl dynamically using Database first Approach

what i am trying to do is exclude few column from EF store and EF modal. for reference there are two method : https://stackoverflow.com/a/40742144/4998968 but i want to exclude column when edmx file is created i.e when i connect my database using…
2
votes
1 answer

Asp.Net Core 2.0 error while scaffolding my database to generate Models

I'm getting this error: Could not load type 'Microsoft.EntityFrameworkCore.Infrastructure.DesignTimeProviderServicesAttribute' from assembly 'Microsoft.EntityFrameworkCore, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. while…
2
votes
2 answers

How to pass Session data from controller to View (MVC)

I'm new into MVC and I'm having a hard time solving this following issue. I got a userID via Session["LoggedUserID"] as it get once the user log in. I want to pass it to following cshtml code(or directly in controller?) which I do not understand for…
skylake
  • 409
  • 2
  • 9
  • 24
2
votes
0 answers

How to deploy entity framework code first for a standalone app

I have just finished an standalone desktop application in C# and .Net. For the app, I need to access several existing SQL Server tables for various data. I accomplished it with Entity Framework 6 code first. My question is how I should update the…
2
votes
0 answers

How to get rid of two navigation properties in one table using entity framework (database first)?

I have two tables: User and Order. User can be manager and client. Both of them must be in Order record. Here is the example of database. And entity framework (database first) generated for me following models: public partial class User { …
Svys2nov
  • 51
  • 2
2
votes
4 answers

Database first ORM for Play Framework (Java) with auto DB model generating

Several years I develop at work in C#, MVC, Entity Framework, database first. Now I want to try Java and choose Play Framework and IDEA as IDE. Now I search such ORM system as: easy integrating in Play Framework; have class generation from…
2
votes
1 answer

MiniProfiler setup - A null was returned after calling the 'get_ProviderFactory' method

After hours of struggling with MiniProfiler to make it profile the Database queries, I have no luck and I'm getting the error: A null was returned after calling the 'get_ProviderFactory' method on a store provider instance of type …
2
votes
2 answers

MVC + EF DB-First Unit Testing

I am wondering whether Unit Testing is possible if I use a DB-First Entity Framework model -- or shall I rather do Integrity Tests only? Can I detach the system from the DB while testing? I already have a context factory to have maximum one context…
2
votes
1 answer

Entity Framework Database First inherits models from base class

I am using Entity Framework Database First for working with db. I have a base class EntityBase public class EntityBase { public Int32 Id { get; set; } } I have some other classes that are generated by EnitytFramework and represents…
2
votes
1 answer

Entity Framework 4.1 DataBase First : Table Inheritance

I have a database which was generated with EF code first. I have table inheritance. Now, that I have the database created, I need to do another project in my solution. This projects perform some operations on database after a concrete time has…
Willy
  • 9,848
  • 22
  • 141
  • 284
2
votes
1 answer

Entity framework database first mappers issue

I am using VS2010, with SQL server 2008 R2. I am a complete beginner at both c# and Entity Framework. The issue I am having in the example below is that when I try to get the questions associated with a particular tab The SQL produced is incorrect.…