Questions tagged [database-first]

171 questions
0
votes
1 answer

asp.net mvc with entity framework database first domain model validations

I'm Developing ASP.NET MVC Web Application project, and I'm using Entity Framework Database First Approach, So I would like to make validations on generated model classes, I know if i make validations on them directly, then my model validations will…
0
votes
0 answers

How to map database changes in code first approach with existing database?

At the moment I'm using .edmx file & database first approach to develop my application. But whenever a changes occur in the database, .edmx file needs to be updated, which seems a bit too much. Once I heard that we can use code first approach but…
Badhon Jain
  • 938
  • 6
  • 20
  • 38
0
votes
2 answers

When I Fill the Create View and Submit It's throwing a DbEntityValidationException

In this project i was trying a Entity Framework Code First Apporach Table 'Employee' Id int NOT NULL FirstName nvarchar(50) NOT NULL LastName nvarchar(50) NOT NULL MiddleName nvarchar(50) …
0
votes
1 answer

How can I reference two databases using Entity Framework database first?

I have an MVC project with references to two seperate projects, each of which contains an edmx. Each of the two EDMX projects point to a different database. The two databases have tables with identical names - contacts for instance. I need both,…
tintyethan
  • 1,772
  • 3
  • 20
  • 44
0
votes
4 answers

Different Key in Table relations

I have a database with this structure TASKs SubTasks ============================= Id (pk) Id (pk) Name Name TaskCode ParentTaskCode Now I need to connect SubTasks Table to Tasks using Tasks.TaskCode…
Ayman
  • 1,387
  • 4
  • 20
  • 35
0
votes
1 answer

Enums and lookup tables in Entity Framwork Database first

I am using Entity Framework Database First approach, and I use enums for the lookup tables. In database, the "normal" tables have a reference to a lookup tables, example: Pet table: Id Name PetTypeId PetType table: Id Name When I do the mapping…
Pedro Perez
  • 842
  • 6
  • 23
0
votes
1 answer

One edmx file, multiple databases with different implementation - support mapping details

I have conceptual (domain) model which is implemented in different ways in separate databases. For example, inheritance in first db is table per type, second - concrete types are tables, and third - all types properties are merged in one table.…
Olinad
  • 187
  • 1
  • 1
  • 13
0
votes
1 answer

Best way to use Entity Framework (Database First , Model First , Code First)

I Am Confused To Choose Way Of Use Entity Framework. What's Differents In These Ways (Database First , Model First , Code First) ? I Just Started A Medium Project (This Project In ASP.NET MVC And Likely MIS & CRM) Thanks For Helping Me.
0
votes
1 answer

Creating a MVC4-Controller using Entity Framework

Hey Guys I hava a question. I know questions like this are asked often, but I worked on a solution for several hours and read many answers but I couldnt find the right one. I am doing an application using ASP.NET MVC 4 Razor. I´m rather new to this…
0
votes
1 answer

Adding a new field to Model with Database-First Approach MVC3 does not pull data from database

I'm trying to add a new field to an existing database (MS SQL Server) and MVC 3 model using the database-first approach. The database and model structure is very complex and the DB hold lots of data, so it is not an option to drop the database and…
mvc_tyro
  • 1
  • 1
0
votes
1 answer

EntityFramework Database first or Code first

we have a existing MS SQL Database where the foreign Keys are not mapped properly. Furthermore some Views without PKs. My Question now is should I generate the POCOs on my self with e.g. Reverse Engineer Code first or should I use the…
Rayk
  • 63
  • 8
0
votes
1 answer

Brand new WPF Application, MVVM, and how to use POCO partical classes generated from ADO Entity Data Model....?

I've asked this before, but I actually still needed help... Here's the scenario: I'm starting a new WPF application, and want to use MVVM. Because our DBA has created a database with tables we need to perform CRUD operations on, I used the Database…
0
votes
1 answer

How can domain model classes (generated by EF 5 Database First) support custom logic when a database update replaces the code?

Please pardon the long-winded title to this post. Basically, I have an entity model that was generated by Entity Framework 5 using the Database First method. Now I would like to develop those POCO entity classes by adding validation logic and…
BCA
  • 7,776
  • 3
  • 38
  • 53
0
votes
1 answer

( MVC3/Entity Framework) How to perform CRUD operation in a database that uses Candidate keys as foreign keys

I am a complete beginner in MVC3 and web development in general. My client database uses unique candidate key of one table as foreign key of another. I cannot change the way the database is designed whatsoever. I have models derived from the…
0
votes
1 answer

why the detached entity is modified successfully in entity framework 5?

my code is . class Program { static NorthwindEntities context = new NorthwindEntities(); static void Main(string[] args) { Order updateorder = new Order() { OrderID = 10256, ShipCountry =…