Questions tagged [ef-model-first]

231 questions
1
vote
1 answer

EF6 Model First: schema specified is not valid, error 0040

I see that this question has been asked quite a bit, but none of the solutions have helped me since I'm using model first and not code first. I have a C# project in VS 2015 using EF6. I am building a database using the model first approach and can…
Grant Bartel
  • 363
  • 1
  • 3
  • 21
1
vote
1 answer

How to map foreign keys in two entities referencing each other

I have an error here and can't quite get the logic behind it. I am using Entity Framework 6 with a model-first approach. I have designed two tables that reference each other like this: Basically, an account needs to be in a company while a company…
LeonidasFett
  • 3,052
  • 4
  • 46
  • 76
1
vote
0 answers

Getting empty Array from WebAPI and SQL Server in AngularJS

In my project I'm getting an empty array from database. I'm using SQL Server, WebAPI 2 and for the client side AngularJS to display the data from the database. I don't know what is wrong. Here is the client side code: $http.get('/api/group') …
yuro
  • 2,189
  • 6
  • 40
  • 76
1
vote
1 answer

Cannot create Controller with actions using Entity Framework

I've created a Model using Model first and Entity Data Model of Entity Framework. Well, when I want to create the controller (right click on controllers folder Add->controller->WebApi 2 Controller with actions using EF) then I become after defining…
yuro
  • 2,189
  • 6
  • 40
  • 76
1
vote
0 answers

Model-First View

Is there a more elegant way to maintain a view in Model-First Entity Framework? There's plenty of discussion regarding how to do this using Migrations in Code-First, but of course Migrations are not available when using Model-First. My current…
shannon
  • 8,664
  • 5
  • 44
  • 74
1
vote
0 answers

EF "Model First": Create entity in edmx and db-table from class?

This question is part of my following one I already asked roughly 2.5 years ago: Entity Framework (.NET) Round-Trip Modelling with Model First? I wanted to ask if in the meantime, the following is possible (and from which version of EF upwards): We…
juniper
  • 311
  • 5
  • 13
1
vote
1 answer

Entity Framework 6 Model First: how to add inherited entity when base entity already exist

Using Entity Framework 6 Model First. Two entities in the project, Person and Worker Person is the base class of Worker I'm able to create brand new Worker which also create new Person But when a Person entity already exist in database, how would I…
1
vote
1 answer

How to create an Azure Mobile Service using EF Model First?

I've started an ASP.NET Web App project using the template for an Azure Mobile Service and tried to create my model the Model-First approach. After generating my database from my finished model I proceeded to add a TableController class for one of…
1
vote
1 answer

Why does LINQ throw a NotSupportedException?

Let's say we have a table called Car with columns such as ID, Identification, ModelName, OwnerId etc where OwnerId points to the primary key in the Owner table. This is all good, but then we want to add a Driver to the car, since we want to know who…
Eirik
  • 4,135
  • 27
  • 29
1
vote
1 answer

Map a column to be IDENTITY in db

Although I have marked my ID column with .Identity(), the generated database schema doesn't have IDENTITY set to true, which gives me problems when I'm adding records. If I manually edit the database schema (in SQL Management Studio) to have the Id…
Tomas Aschan
  • 58,548
  • 56
  • 243
  • 402
1
vote
0 answers

EF6 Updating database from model overwrites my DefiningQuery

I'm using DefiningQuery to specify a Read only "view" entity that contains fields from two tables, and it works great for my need. But each time I'm updating my model (using the Model designer) and runs the "Generate Database from Model..."…
1
vote
1 answer

when using entity framework model first, how to map string with different db types

for example: public string Name { get; set;} public string Comment { get; set;} How to map Name with nvarchar(20) and map Comment with nvarchar(500)?
plantain
  • 43
  • 1
  • 8
1
vote
2 answers

Entityframework model first decimal precision

I'm using Entityframework 6 with model first. In the diagram I have chosen decimal for my datatype. When I save decimal values, the database only has whole numbers and the decimals get dropped. My first suspicion was to check the precision, however…
Kyle
  • 32,731
  • 39
  • 134
  • 184
1
vote
0 answers

index attribute not honored by entity framework?

I'm using a model first approach. So, I got a generated class namespace XXX.GlobalDatabaseModel { using System; using System.Collections.Generic; public partial class LocalizedFoodGroup { public int…
1
vote
1 answer

ASP.NET Join Identity table to model first tables

I'm new to ASP.NET MVC 5 and I'm trying to build an application in it. I've been reading around, and experimenting with various approaches, and I've decided to go with the model first approach. I want to use Identity for the authentication. I've…
GMon
  • 638
  • 6
  • 14