Questions tagged [ef-model-first]

231 questions
5
votes
1 answer

EF - Navigation property is null, even after reloading entity, but works when program is restarted

EDIT I've done some testing and found out, that the Item navigation property only works when the context is disposed/a new context is created. DataContext context = new DataContext(); Order ord = context.Orders.FirstOrDefault(); …
Lahey
  • 429
  • 1
  • 6
  • 16
5
votes
2 answers

Mapping Boolean property to Oracle using Entity Framework

I need to connect a system to oracle using entity model first. I have a model with the entity "Entity1". "MyBool", as the name says, it's a boolean property. I sucessfully generated the sql script from the model and run it on oracle database. Then…
Thiago
  • 1,103
  • 1
  • 16
  • 25
5
votes
2 answers

Adding a custom t4 template to DDL Generation Template dropdownlist

I know I can add the template in the folder C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen to make it visible in the DDL Generation Template dropdownlist, but then I need to…
OKB
  • 715
  • 3
  • 14
  • 30
5
votes
1 answer

how to generate table per hierarchy using entity framework 5 model first

I'm using Visual Studio 2012 with entity Framework 5 model first. I would like to generate my database using a table per hierarchy strategy, but can't find that option. The Entity Designer Database Generation Power Pack is not available for visual…
4
votes
2 answers

How to call Database.SetInitializer on model-first?

I created a model in the edm designer (VS10) using "DbContext Entity Generator" as the generation item. In the generated DbContext subclass, it overrode the constructor so I can't use it in the other partial class: public EntitiesContainer() :…
Shimmy Weitzhandler
  • 101,809
  • 122
  • 424
  • 632
4
votes
0 answers

How to disable "Save entity connection settings in app.config" always

When i execute the command "Generate Database from Model..." from my EntityFramework-Model (.edmx) the CheckBox "Save entity connection settings in app.config" is always checked. But i want that it is not checked by default. Is there a way in the…
Jehof
  • 34,674
  • 10
  • 123
  • 155
4
votes
1 answer

String replace on select with Entity Framework

I have a SQL Server data source which cannot be modify (I'm not the dbo). I use Entity Framework 6 model-first to do my querying. Everything is fine except that I must select costumer names and there's only two character discrepancy. Datasource …
4
votes
1 answer

Specify Index Column in EF Model-First

How to define a property as index column, in EF Model-First? Five years later when this question had been asked for EF-4.0. Do we still have to manually edit .edmx file to add index? I believe this is a pretty trivial scenario & there must be a…
Abhijeet
  • 13,562
  • 26
  • 94
  • 175
4
votes
4 answers

EF4 Generate Database

I am trying my hardest to find the simplest way to create a basic "model first" entity framework example. However I am struggling with the actually generation of the database, particularly the running of the SQL against the database. Tools Visual…
Shane
  • 401
  • 4
  • 16
4
votes
1 answer

Entity Framework 6 Model-First - Update Production Database Based On Local Changes

I'm new to EF and inherited a project that apparently used database-first development. The production environment uses SQL Azure and I'm basically trying to figure out the standard approach for updating its schema. At first, I tried enabling…
4
votes
1 answer

Entity Framework Model-First Enum Type MetadataType

I know when working with model-first development, you can use partial classes generated by the t4 templates to add metadata. e.g. public partial class Address { public int Id { get; set; } public string Street1 { get; set; } …
Dan Champagne
  • 890
  • 2
  • 17
  • 37
4
votes
1 answer

Updating Database model (.edmx) Model First

I am having a few problems with updating the model in EF using Model First. I have exhausted my efforts with the suggestions of adding migrations (which is normally done using Code First). The Package Manager Console prints the message Creating a…
user1752532
4
votes
1 answer

Does ODP.NET support EF Model-First with DbContext?

We're trying to use an Entity Framework Model-First approach with Oracle 11g and ODP.NET 11.2.0.3.20. We'd like to use EF 4.1 or EF 5.0 with DbContext. Short version: Has anyone managed to do that? Long version: On VS2010 and Entity Framework 4.0,…
Jonas Sourlier
  • 13,684
  • 16
  • 77
  • 148
4
votes
2 answers

Learning Entity Framework for using with MVC, Which approach to take first?

I'm a beginner to MVC, as well as EF. I've decided to understand things more clearly in order to perform well using these technologies. Now, i've started reading about EF, and knew that there're Model-first, Database-first and Code-first…
4
votes
2 answers

Reference external type enum and contains method

Since I have switched to .net 4.5 and EF 5.0 I have started using enums mapping. In my project I'm using model first. Because all of enums were declared earlier so I have decided to user option "Reference external type" while I was converting fields…
1 2
3
15 16