Questions tagged [ef-database-first]

The Database First Approach of Entity Framework provides an alternative to the Code First and Model First approaches to the Entity Data Model and it creates model codes (classes, properties, DbContext etc.) from an existing database.

The Database First Approach of Entity Framework provides an alternative to the Code First and Model First approaches to the Entity Data Model and it creates model codes (classes, properties, DbContext etc.) from an existing database.

731 questions
0
votes
1 answer

How to get my model and database back in sync Asp.net MVC

I created an application in Asp.Net MVC using the database first method. I generated my model using an edmx file. However i made a change to my context classes. Everytime i run my application i get the following error: "The model backing the…
0
votes
3 answers

Connection of MVC 3 application with the ever changing database

I have just started learning ASP.NET MVC 3 and I am deep trouble deciding the best way to connect to the database for my application. As my application database will be enhance in regular intervals so new tables, columns could be added/removed and…
0
votes
1 answer

Converting comma delimited items to an entity using edmx

Is it possible to convert the column (stored as comma delimited) to be presented in the edmx designer as another entity? table structure student id name subjects << this is the comma delimited column (1,2,3,10) subject id name EDMX…
0
votes
1 answer

MVC4 Foreign Key constraint prevents posting insert to SQL db

Using MVC4 I'm trying to insert a column into a linking table that has a two column composite key. Both columns are primary key in two separate tables. Key1 is picked up from a hidden field in the web form which is generated from an id passed in the…
melkisadek
  • 1,043
  • 1
  • 14
  • 33
0
votes
1 answer

Auto generate models in mvc 4 database first?

I created an mvc 4 web project using database first and entity framework but was surprised to see that default models were not generated automatically, is there a way to create them from my .edmx file or are there any other possibilities to save…
Mike
  • 369
  • 1
  • 6
  • 24
0
votes
3 answers

How easy is it to change DB in a MVC3 project?

Basically I have made a MVC3 application that connects to and updates a database that exsists on a server. This database is a test one however, and when I roll out the project live I need it to connect to the actual database. My question is how hard…
Bohdi
  • 1,295
  • 4
  • 28
  • 62
0
votes
1 answer

Entity framework Database First & EF Code First get Relation Object By ID

in EF Database First when change ForeignKey(CommodityGroupID) automatic Get CommodityGroup for Commodity object, But in EF Code First(4.3.1) not doing. public class Commodity { public int CommodityID { get; set; } …
Hono
  • 1
0
votes
2 answers

MVC Music Store linked table data

I've been looking at this problem for about two weeks now and think it's time I ask for help... I'm trying to get the MVCMusicStore shopping cart tutorial working in Part 8: http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-8.…
0
votes
2 answers

Where does EF4 DB first get it's relationship names?

I have a database table called "item" that has a self-referencing field called "itemParentID". When I generate an EDMX and models, I gain access to to "item.item1", which is the parent of the current item and "item.items1", which is a collection of…
Joel Peltonen
  • 13,025
  • 6
  • 64
  • 100
-1
votes
1 answer

How to migrate asp.net mvc to asp.net core with asp.net identity framework database first

I have a database first asp.net mvc application now I want to migrate it to asp.net core with all my identity tables and use it like database first. I research a lot but could not find any reasonable source.
-1
votes
1 answer

change schema name at edmx file dynamically using entity framework 6 db first approach with Oracle DB

i have a UI page which contains, a drop down, with multiple values. From a UI page, user will select one schema from the drop down, then the data related to that schema should be loaded to a grid. That means in future we may get more number of…
-1
votes
1 answer

How does EF DB First works for subsequent updates into DB?

Generating POCO from db works like a charm, however what if further tables / columns are added into DB. How to perform incremental updates of POCO in case of EF DB first? Here are two alternatives I could think of: Or shall we fall back to…
Abhijeet
  • 13,562
  • 26
  • 94
  • 175
-1
votes
2 answers

Entity Framework database-first - dynamically adding table to model

I have tables with the same structure but with a letter prefix of every table. For example: A_Company, B_Company, C_Company There is combo box from which the user can select A, B or C, and then the code saves data into the appropriate table. How…
Nurlan
  • 105
  • 1
  • 10
-1
votes
1 answer

Primary key stays null after inserting Entity with Entity Framework

I want to insert a new entry into my database with the following commands: Repository repository = new Repository(); Fueltype fuel = new Fueltype() { Name =…
romaneso
  • 1,097
  • 1
  • 10
  • 26
-1
votes
2 answers

ModelState.IsValid is false on datetime post with EF Database First

I am using Microsoft's Entity Framework 6.1.3. with Database First (from an Azure SQL Server instance). The automatically generated Entity looks like this - the database column is datetime2(0) but really I just want to persist the date but that's…
1 2 3
48
49