Questions tagged [database-first]
The database-first tag has no summary.
database-first
173 questions
Tooling
0
votes
4
replies
92
views
Is there a Database First approach in Java like Entity Framework in C#?
I’m used to working with a Database First approach in C#. I design my database schema (often with MySQL Workbench) and do a forward engineering, then generate my C# models using Entity Framework’s. ...
1
vote
4
answers
4k
views
Create an ASP.NET Core MVC application with database-first approach
I want to create an ASP.NET Core MVC application. It seemed it was no good idea to use a .NET Framework project, since the abandon of Entity Framework 6.
So, I try .NET Core, and I read this:
Entity ...
0
votes
1
answer
383
views
How to extend SQLAlchemy generated classes in declarative model outside of the model?
I am using SQLAlchemy + sqlacodegen in my python project.
I have succesfully generated declarative model from my database, which looks like this:
DB_Model.py
...
0
votes
0
answers
2k
views
Cannot find ado.net entity data model in visual studio 2022
I want to start a new project in ASP.NET core MVC web application. In the past I'm used to starting with the code, I create the code and I create the dbContext and I make the migration of the data Add-...
0
votes
1
answer
81
views
C# Code First Vs. SQL Database first when using a business logic layer
I am firmly in the camp of being a database first developer. I believe there are pro's and cons' to each approach. However when creating a code first approach should the newly created classes have ...
3
votes
1
answer
83
views
New web project design pattern specification
I have a relational database with more than 50 tables. They have more than one type of relationship, one to one, more than one.
Will code first or database first be more effective in the new MVC ...
0
votes
1
answer
62
views
How to call the Session inside ajax based on RoleId in Controller?
I need to call a certain webpage based on Id in user.RoleId which is in my controller and in the script page it needs to call ...
0
votes
0
answers
544
views
How to work and add new table to database first model in asp.net core?
I have an existing SQL Server database that populated with data via another app. I want to work with this database in a new project (ASP.NET Core web application).
I know I can add this database to my ...
0
votes
1
answer
274
views
Add SQL function into project with EF6
I want import my function from SQL Server into my ASP.NET MVC project with EF6 database first.
My problem is when I update database in .edmx file, based on what I ...
2
votes
2
answers
1k
views
Entity Framework Core Database First not render Model of Stored Procedure?
Database
I have Stored Procedure name GetAllCustomer
I have Stored Procedure in the EntityFramework 6x and in Project ASP.NET MVC5.
I'm using by calling ...
2
votes
2
answers
2k
views
EF core Scaffold-DbContext doesn't work : Execution Timeout Expired
I'm trying to scaffold Models from an existing database.
Scaffold-DbContext "connectionString" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
...
1
vote
1
answer
4k
views
How to connect to a SQL database on MacOS with Entity Framework Core and Database First
I have recently changed from Windows to MacOS and I'd like to make a simple project with ASP.NET Core Entity Framework with CRUD operations. I want to use Database First.
So please can someone guide ...
1
vote
0
answers
284
views
How to use a Database-first registered DbFunction inside another context with Linq To Entities?
I would provide an Oracle Database function (ie. RemoveDiacritics) in my low-layer C# package which is installed on multiple websites, to allow these applications to use my custom function inside ...
0
votes
0
answers
3k
views
Violation of PRIMARY KEY constraint 'PK. Cannot insert duplicate key in object 'dbo.Cursuri'. The duplicate key value is (0)
My assignment is to do crud operations using database first on an Windows Form app. Currently my save button (Salveaza) is not working properly ( I get the above error when I debug it) and I don't ...
1
vote
0
answers
44
views
Add ASP.NET Core Identity to an existing project that has the database first model
I would like to add ASP.net Core Identity in an already existing project, which already has many tables mapped with database first, also I should add a relationship between AspNetUserId and my table ...
0
votes
1
answer
57
views
Tuple Problem @model Tuple<HabasPortal.Models.Profile,List<SelectListItem>>
I use database first on my project.I wil save to Profile table and fill a dropdown from department table on this page . How do I use both profile.cs and ...
3
votes
1
answer
1k
views
Generate the EDMX backing files in Visual Studio 2019
After modifying an EDMX in Visual Studio 2019, it saves the EDMX properly but does not generate the C# files.
This is a database first functionality, is there a new trick in VS2019 to actually ...
3
votes
1
answer
13k
views
EntityFramework Core database first, Scaffold-DbContext A positional parameter cannot be found that accepts argument '--use-database-names' error
I am trying to create the model from existing DB using EntityFramework Core, database first approach. The model was created, but the table name and column name were changed to C# style. Because I want ...
0
votes
1
answer
597
views
having problem with updating model entity framework in database-first approach
I've used entity framework in my projects and i used database-first approach
almost in each time that i change the database ( adding/removing a field to existing table or add new table ) after updae ...
2
votes
0
answers
210
views
How to exclude some column from .edmx file, *.csdl ,*.msdl, and *.ssdl dynamically using Database first Approach
what i am trying to do is exclude few column from EF store and EF modal.
for reference
there are two method :
https://stackoverflow.com/a/40742144/4998968
but i want to exclude column when edmx file ...
0
votes
0
answers
170
views
Does enabling the "read committed snapshot" inside SQL Server 2012, require re-mapping our database tables
I am working on an ASP.NET MVC web application, and we already have a SQL Server 2012 database. So I mapped the database tables inside our ASP.NET MVC using ADO.Net Entity Framework version 5.0, and I ...
0
votes
0
answers
77
views
EF database-first approach with 2 databases (test db and production db)
I'm developing a web API with existing database and it has 600k+ records on it. I will be using EF with a database-first approach and planning to clone the production db for staging purposes.
I'm ...
0
votes
1
answer
683
views
Relationships in pony.orm with create_tables=False
The intention is to have two simple classes representing two related tables that already exist in the db.
The code is:
...
1
vote
0
answers
270
views
Firebird Entity Framework casts all string parameters to Varchar(8191)
I'm using VS2017 and Firebird as database. I use database first to create my Model from all stored procedures. When I execute a procedure, all string variables cast as ...
3
votes
1
answer
1k
views
Core 2 Keep domain models in sync with database changes
Need help! I am new to Core 2.0 and VS 2017 and haven't had much experience with MVC. I have an existing database that I need to use with a core 2.0 project at work. I was able to use the Scaffold-...
1
vote
2
answers
2k
views
Use "Attach" as an Upsert in Entity Framework Core
According to oneunicorn,
DbSet.Attach puts all entities in the graph into the Unchanged state. However, entities will be put in the Added state if they have store-generated keys (e.g. Identity ...
3
votes
1
answer
3k
views
using Enum for dropdownlist in databasefirst mvc
I have a field in Model(tablaMetadata) with boolian field for gender as below:
(I work with database first MVC)
...
1
vote
1
answer
653
views
EF update model from SQL Server 2016 database takes too long
The project I work on uses the process of database first, update EF model from db afterwards.
I face the following problem: if the database is in "compatibility level SQL Server 2016", my update of ...
2
votes
1
answer
776
views
Asp.Net Core 2.0 error while scaffolding my database to generate Models
I'm getting this error:
Could not load type 'Microsoft.EntityFrameworkCore.Infrastructure.DesignTimeProviderServicesAttribute' from assembly 'Microsoft.EntityFrameworkCore, Version=2.0.0.0, Culture=...
0
votes
0
answers
33
views
Generate entities for 1:1 relationship without PK on the related table
I have three tables in existing sql db:
Events
ConcreteEvents1
ConcreteEvents2
There is 1:1 relationship between events and concrete events and only events table has PrimaryKey.
Is there any way to ...
0
votes
1
answer
560
views
Create webapp with full stored procedures
I want to create a web application, all actions (Create, Update, Delete) should be done using SQL stored procedure. Every action in the web just calls a stored procedure and receives json data to ...
1
vote
1
answer
4k
views
Getting "the wait operation timed out" on simple query, other queries work, works on local db
I have a very simple LINQ query where I call a view to get an object, basically it looks like this:
context.view.FirstOrDefault(p => p.id == key)
Key and id ...
1
vote
3
answers
77
views
Linq-to-sql many-many in database first
I have a database with 2 table Song vs Artist mapping by Mapping_Artist_Song, then i add existing database to models(database first) in my project and now i dont know how to use linq to select song ...
0
votes
1
answer
454
views
Integrate MVC Core Identity with other Database First Tables
I am using MVC Core with the default individual user authentication.
I added FullName field to AspNetUsers Table and it is working fine.
I need to create a relationship between my tables to the id ...
0
votes
1
answer
414
views
Batch Rename Classes in Entity Framework Database First
Is it possible to batch rename the Class (Entity) names in auto generated .cs files inside edmx model? I need to have uppercase first letter for all the entities e.g. "account" needs to be changed to "...
0
votes
1
answer
253
views
Entity Framework Database First Approach
I am working on a project in which I am assigned to implement database first Approach. Here, I want to know that when we initiate database first approach we map that to an existing DB, but what if I ...
15
votes
5
answers
9k
views
"No executable found matching command dotnet-ef" error with EF Core database-first
As you know, the newest version of Visual Studio 2017 abandons the 'project.json' and uses .csproj instead.
I'm using the RTM version and want to generate model ...
0
votes
1
answer
53
views
Posting data from view to model and control returns null
I am currently busy with an project where I do use ASP.NET MVC.
When I try to post data to model and controller I am getting NULL returned in the parameter of the method I have used in the controller....
1
vote
2
answers
582
views
EntityFramework v6. Database first. Not Decorating property with Key even though table has Primary Key
I choose Database First:
Here is an example table that is experiencing this issue. As you can see the EntityId column is the Primary Key:
The imported table in the model browser shows that it has the ...
0
votes
0
answers
244
views
Error When Converting Project from Code-first to Database-First
I have worked on a project with Code-first Approach and know I need to convert it to Database-first Approach, because I have some logic I have to executed it through Stored-Procedure.
So, I decided ...
0
votes
0
answers
114
views
Error sending a string to SQL Server
I'm working on a project with C# and SQL Server. I have a table called Area and it has a column called flag, it is a ...
7
votes
7
answers
7k
views
Get parent department node in Entity Framework
I have a SQL table like this:
DepartmentID is parent of department. I've build a tree by this table(in ASP.net (C#) project):
Records in tree above is:
I need to ...
2
votes
2
answers
13k
views
How to pass Session data from controller to View (MVC)
I'm new into MVC and I'm having a hard time solving this following issue. I got a userID via Session["LoggedUserID"] as it get once the user log in. I want to pass ...
0
votes
0
answers
380
views
C# Entity Framework Database First: Create association so that an entity has a list of the same entity type
I have the following scenario to solve, using entity framework and a database first approach:
A table Student having the fields:
...
1
vote
2
answers
3k
views
MVC ModelState error "The ID field is required" although the database generates an ID
I created the MVC application database-first with the ID field being generated by the database.
Since the ID is generated by the database, in the Model I set the 'StoreGeneratedPattern' property to '...
0
votes
1
answer
166
views
Visual Studio 2015 version 3 freezes on editing Roles in Azure project
I'll preface this with the fact that I'm very new to Visual Studio, so I am prepared to hear that my problem lies in something I haven't read yet.
I have a database first project in Visual Studio ...
0
votes
1
answer
177
views
Lightspeed database-first tables with plural and singular generating same entity names
I am using Oracle and LightSpeed Orm and generating model from database.
It seems there is an issue while creating tables that ...
38
votes
7
answers
93k
views
Adding a New Column to an Existing Table in Entity Framework
I have added a new column to a table in my database. The table is already defined in the existing Entity Framework model. I've been through most of the items here on how to do this and it still fails. ...
1
vote
1
answer
282
views
ASP.Net Identity Connect to Existing Non Identity Tables
I'm working on a project in asp.net mvc. I want to authenticate users using Asp.Net Identity and Owin. I'm aware that Identity has its own tables which are created using code first approach. However, ...
3
votes
2
answers
3k
views
Entity Framework - Database First - Invalid column name error
I have three simple classes and I am wiring up EF6 to an existing database.
Classes are as follows
...