Questions tagged [database-first]

171 questions
4
votes
2 answers

Adding validation to model with Database First model (EF 5)

I know how to add validation errors to the model state. I know how to add the validation annotations to my model classes. The problem is that with Database first, I don't want to touch the generated code, because when I regenerate, I will lose my…
sheamus
  • 3,001
  • 4
  • 31
  • 54
3
votes
1 answer

New web project design pattern specification

I have a relational database with more than 50 tables. They have more than one type of relationship, one to one, more than one. Will code first or database first be more effective in the new MVC project I will create based on this…
3
votes
2 answers

NHibernate Database-First

I'm putting a front-end together for one of our databases and would like to use NHibernate for it. Can anyone point out any resources for getting started with Database-first approach? Most tutorials I've seen are for Code/Entity First. ASP.NET MVC 3…
Nasir
  • 10,935
  • 8
  • 31
  • 39
3
votes
1 answer

Generate the EDMX backing files in Visual Studio 2019

After modifying an EDMX in Visual Studio 2019, it saves the EDMX properly but does not generate the C# files. This is a database first functionality, is there a new trick in VS2019 to actually generate the C# files on save?
jsgoupil
  • 3,788
  • 3
  • 38
  • 53
3
votes
1 answer

EntityFramework Core database first, Scaffold-DbContext A positional parameter cannot be found that accepts argument '--use-database-names' error

I am trying to create the model from existing DB using EntityFramework Core, database first approach. The model was created, but the table name and column name were changed to C# style. Because I want the model still using exact table name and…
wltz
  • 621
  • 1
  • 11
  • 22
3
votes
1 answer

Core 2 Keep domain models in sync with database changes

Need help! I am new to Core 2.0 and VS 2017 and haven't had much experience with MVC. I have an existing database that I need to use with a core 2.0 project at work. I was able to use the Scaffold-DbContect to initially create the domain models from…
3
votes
1 answer

using Enum for dropdownlist in databasefirst mvc

I have a field in Model(tablaMetadata) with boolian field for gender as below: (I work with database first MVC) [DisplayName("gender")] [Display(Name = "gender")] public Nullable EmpSex { get; set; } I want to get value from EmpSex as…
3
votes
2 answers

Entity Framework - Database First - Invalid column name error

I have three simple classes and I am wiring up EF6 to an existing database. Classes are as follows namespace Infrastructure.Models { [Table("Applications")] public class Application { [Key] …
Solo812
  • 401
  • 1
  • 8
  • 19
3
votes
1 answer

how implement mvc 4 project using crm 2011

we have crm 2011 and we want to develop asp.net mvc 4 project which uses crm 2011 db. What is the best way to do this? Also we have these questions: Can we use svcutil generated classes? Which is more suitable for such project Database first…
3
votes
2 answers

Entity Framework Database First regeneration make me lose manual changes

I'm making a website with MVC .NET. Since I'm an old school programmer who learn to design database first, I opted for the Database first approach. I'm also using "code generation" which create files with the extension .tt . Everything is working so…
Jean-François Côté
  • 4,200
  • 11
  • 52
  • 88
3
votes
1 answer

Asp.NET MVC 4 Entity Framework 5 - Unable to find the requested .NET Framework Data Provider

I'm developing Asp.NET MVC 4 web application. I'm trying to connect to my database "Test" through Entity Framework Client. I've added EntityFramework reference to project and I'm using MSSQL. From unknown reason, I'm getting the following…
3
votes
1 answer

Edmx missing foreign keys

I am mapping my database using Entity Framework, using the database-first approach. The problem is that the edmx file that should be mapping my exact database is missing some FK relations between the tables, which causes me to change my queries,…
mashta gidi
  • 849
  • 1
  • 10
  • 30
3
votes
1 answer

Why MetadataType doesn't do my validation in database first approach?

I used Database-First to generate a model class (EDMX file), and I want to validate using "MetadataType". I read solutions here but they didn't work for me. Here is my code: [MetadataType(typeof(MovieEntitiesMetaData))] public partial class…
2
votes
1 answer

How to get MVC-mini-profiler working on EF 4.1 Database First

Spent better part of the day combing through SO for this. Here's the setup MVC 3 App using Repository pattern with 3 repositories across 2 databases. EF 4.1 Database first using the DBContext API for both db connections. Installed…
2
votes
2 answers

Entity Framework Core Database First not render Model of Stored Procedure?

Database I have Stored Procedure name GetAllCustomer I have Stored Procedure in the EntityFramework 6x and in Project ASP.NET MVC5. I'm using by calling db.GetAllCustomer.ToList(); But in the EntityFramework Core it's not rendering DbSet and I…
1 2
3
11 12