Questions tagged [db-first]

Db-First is an approach used in Entity Framework ORM which means the database tables model comes first than model.

Db-First is an approach used in Entity Framework ORM which means the database tables model comes first than model. In this approach, Entity Framework generates the model from the database tables model.

73 questions
0
votes
1 answer

EntityFramework mapping fragments issue

I am working on an API web project, in ASP.net, and on the recommendation of several stackoverflow users, with a description of my problem, I have decided to use EntityFramework. Work on a database already created, and formed, with all…
Pedro Jose
  • 442
  • 3
  • 19
0
votes
0 answers

How do I extend IdentityUser class in DbFirst approach?

I have a table named User in my database. I also have a .net core project where authentication is built-in. I want to connect to my database and after scaffolding reveals my User class, I want it to inherit from IdentityUser. After scaffolding went…
Guga Todua
  • 462
  • 2
  • 11
  • 27
0
votes
1 answer

Error Adding Controller because of Model Relationships

I get an error message when trying to add a controller (presumably) because of incorrectly defined relationships. I cannot find what my issue is. I have two simple models: Scenario and Condition. A Scenario can consist of multiple Conditions, but a…
Wallen
  • 152
  • 1
  • 8
0
votes
1 answer

Using command line how to do scaffolding from DB first in ASP.NET - not ASP.NET Core MVC?

I am writing an application that needs to use ASP.NET MVC scaffolding from DB-first at runtime. It tests scaffolding from Cli in .NET Core following this link: https://www.learnentityframeworkcore.com/walkthroughs/existing-database I know how to…
0
votes
1 answer

Get error when scaffold MS Access database (Could not find installable ISAM)

I am using Entity Framework 6 to manage an MS Access database (mdb file). I am now using this project (bubibubi / EntityFrameworkCore.Jet) But in their example, it uses a * .accdb file while I'm using a * .mdb file. When i…
0
votes
2 answers

EF Cannot remove object

In my model I have similar tables: Persons (ID-NAME) e.g. (1-Paul - 2-Frank - 3-George) Roles (ID-NAME) e.g. (1-Admin - 2-Developer - 3-Junior) Persons_Roles (ID_PERSON Not Null - ID_ROLE Not Null e.g. (1-1 - 1-2 - 2-3 - 2-1 - 3-2) Table…
Fudo
  • 3
  • 2
0
votes
1 answer

How to get data from Junction Table using DB First Approach in MVC

I have Many to many Relationship between 2 tables and i want to retrieve data from junction table. I'm sharing some source first Image of Database tables: https://imgur.com/BDvPiQa Image of EF Model…
0
votes
1 answer

Many to many relationship entity framework core db first

I have the entities Products and Tags. I have many to many relationship between the 2 tables, so I have tertiary table. My Product Entity: public class Product { public Guid Id { get; private set; } public string Name { get; private set;…
0
votes
1 answer

What is the behavior of entity framework when a table does not exist yet for an entity?

We are working with multiple people on a software landscape. And therefore we find it convenient to work in parallel. So the C# code for the entity is being added, while the table definition is being created (db first approach). My question is, can…
Mike de Klerk
  • 11,906
  • 8
  • 54
  • 76
0
votes
0 answers

Entity Framework DB First: How to make a field optional

I have some data class generated from the DB: [Table("appdb.apptable")] public partial class apptable { [Key] public int Id { get; set; } public int Sum { get; set; } public string Comment { get; set; } } How, I need to support…
Alex
  • 842
  • 11
  • 33
0
votes
1 answer

How to manage Database First Project

We are working on a project that uses database first model. At the beginning of the project we decided to use a central db, all developers were using this db. But at the middle of the project, developers decided to use own DB's, they are cloning…
fobus
  • 1,938
  • 8
  • 29
  • 48
0
votes
2 answers

How to map table without primary key Entity Framework

I'm using Entity Framework to map some tables, but I can't do this unless I declare some column as the primary key. The problem here is that my table in my database don't have a primary key and has millions of rows. I don't have permission to create…
0
votes
1 answer

DB-First Entity Framework context not showing my tables

This is my first time dealing with Entity Framework. I add the ADO.NET Entity Data Model class -> Choose the database to use -> Choose the tables I want -> Name / Namespace -> Finish When I look at the class in the solution explorer, there's no…
Deadfish
  • 41
  • 7
0
votes
0 answers

EF code first using specific project on solution with ignoring migrations

I have a solution and it has many projects. My solution look like below: MySolution WinService1 WinService2 WebUI Entities DataAccessLayer BusinessLogic My Winservice1 and WinService2 projects used DAL. My problem is here. If somebody change…
0
votes
0 answers

Concurrency control with Entityframework DBFirst

I have added RowVersion for concurrency control and set Concurrency mode of this field to Fixed.But when I tried to update that column it shows DbUpdateConcurrencyException even though the row is not updated by another user.
Kesiya Abraham
  • 753
  • 3
  • 10
  • 24