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
0 answers

Scaffolding Oracle database using DB First Approach

"Unable to find provider assembly 'Oracle.ManagedDataAccess.Core'. Ensure the name is correct and it's referenced by the project". Dont Know why this error is comming while scaffolding. Scaffold command i used. Scaffold-DbContext -Provider…
0
votes
0 answers

Why In LINQ query DBGeography is not supporting where conditions?

I have trying to get nearby places using DBGeography pointtotext using LINQ using following query. My purpose is to offload distance calculation from .net core and put it on server. Query is for mobile application List list = await (from…
0
votes
0 answers

Using ENUMs with Entity Framework Core Db First

I have a PostgreSQL database in which several tables have fields which are enums. I scaffolded the Db in a MVC Application but it skipped the enum columns although there is reference to them in the DbContext.cs file like this. protected…
A Cameron
  • 27
  • 7
0
votes
0 answers

EF Core: In a Db first project standardizing Id properties in order to implement a generic repository

I have just scaffolded a new database, I want to create a generic repository for crud, but the problem is; DbModels have different Unique Id variable types and names. e.g. Customer.Id, User.UserId, Company.ActuallyRandomPropertyNameId etc. So I want…
Cenko
  • 93
  • 2
  • 7
0
votes
1 answer

How to create models in .NET 5 Web API using EF Core DB first approach

I am working on .NET 5 Web API in which I have several projects in one solution. One project is for only controllers, another one I have added as class library project for interfaces, third project is also class library project for models which I…
Nilesh
  • 518
  • 1
  • 9
  • 26
0
votes
0 answers

Function mapping in Entity framework

So, I am working on an already existing application. The application has implemented a DB first approach. I recently updated a stored procedure. I updated the same stored procedure in the EDMX file, using the model browser. Lets call the SP as…
0
votes
0 answers

Recreate database for database-first Entity Framework v6 and C#

We made an app in C#; we used EF but have created the models using a database-first approach. We lost the database and need to recreate it in order to continue development; how do I use the model in my database-first C# app in order to automatically…
RCM
  • 19
  • 3
0
votes
1 answer

EntityFramework Core 3.1 + with MySql or Pomelo rename table to use DBFirst

I have done two test projects, one with MySQL.EntityFramworkCore and another with Pomelo.EntityFrameworkCore and in both of them the same thing happened to me when obtaining the model from the database. 1.- Scaffold-DbContext 'server = x.x.x.x.x;…
0
votes
2 answers

ef core how to get data from different tables with foreign keys at once? (DB first)

I have two tables in my project, "educator" and "educator license". The educator license is depended to the educator table with foreign key. (DB first) Foreign keys with id in my db: (educator can have N license) my educator model like: public…
0
votes
2 answers

C#; EF database first mode

I used database-first mode in EF. I need your help because I have a problem when I try to run this code: private void btnSearch_Click(object sender, EventArgs e) { string SNumber = txtSearchByNum.Text; var qSearchByTypeText =…
RedBud
  • 13
  • 3
0
votes
1 answer

Is that possible to update multiple procedure and function definition in EDMX file C# DB first approach

I have to update many procs and function in edmx, and I don't want update 1 by 1 in Model browser and also don't want to re-create edmx , So is there any possible solution there, i can update multiple proc or function in edmx file in one go.
0
votes
1 answer

Why my Entity Framework Core Database-First Model Custom Changes Gone After Re-Scaffold? Any Solution

I am working with ASP.Net Core 2.1 & I am facing a problem. I have been working on implementing a Database-First application. The initial Scaffold-DbContext command works just fine and creates all my entities correctly. After that, I make some…
0
votes
1 answer

Pomelo Entity Framework Core Scaffolding fails for MySQL DB "annotation cannot be added because an annotation with the same name already exists."

When I try to scaffold existing MySQL DB using: Scaffold-DbContext "server=server;user=user;password=pw;database=db" "Pomelo.EntityFrameworkCore.MySql" -OutputDir EF -f I get the following error: System.InvalidOperationException: The annotation…
0
votes
1 answer

DB First ,ASP Net Core 2.1, EF6 : InvalidOperationException: No connection string named 'DataContext' could be found in the application config file

I am using asp net core 2.1 and EF 6, using DB First. My connectionString in App.Config: I have this error: An unhandled exception occurred while processing the request. InvalidOperationException: No connection string named 'DataContext'…
0
votes
1 answer

asp.net core 2.1, Include() fonction doesn't work with db first approch

I create new project asp.net 2.1 api for testing DB first approach , I have database for testing "DBTest" it contains “Patients” table, ”Medications” and ”Ailments” tables witch references “Patients” table with foreign keys , for creating models I…