Most voted "code-first" questions
Methodology for mapping between classes . NET and database structures.
Learn more…80 questions
Sort by count of
-
1
votes1
answer103
viewsASP.NET MVC How to Manipulate Table Users Using Code First
I’m studying MVC ASP.NET code first. I’m a beginner and I have a question probably basic. When starting a project, it already creates a basic application, including the table User. I happen to be…
-
1
votes1
answer688
viewsHow to set a string-like field to nullable in Code First?
I got the field descrPapel of the kind string and would like that field to be created as nullable, that is, to accept null when I was gonna do some Insert/update in records of this type of entity.…
-
1
votes0
answers329
viewsMany-to-Many Relationship Entity Framework Code First Composite Primary Keys Repeat Column
in my application I have two entities with a relationship of many to many, namely, Activity and Skill: The EF (Code First) generates for me the junction table, but it is giving conflict if I create…
-
1
votes0
answers61
viewsEntity Framework 6 return cast error
I have two entities that inherit from the same abstract class. public class Empresa : PessoaJuridica { private Empresa() { } public Empresa(string CNPJ, string RazaoSocial, Status Situacao, byte…
-
1
votes1
answer181
viewsInsert in 2 tables Entity framwork - 1 to 1
I have two entities generated by the code-first Wizard: Person [Table("pessoa")] public partial class pessoa { public pessoa() { pessoa_endereco = new HashSet<pessoa_endereco>(); }…
-
1
votes1
answer503
viewsASP.NET MVC + Entity - How to map new tables
Good morning, I have a project using ASP.MVC + EF and mapped about 20 tables using the VS wizard (creating the ADO.NET Entity Data Model, selecting the database and the tables I want), but now I…
-
1
votes1
answer260
viewsMigrations error loading System.Configuration.Configurationmanager - Migrations
I have a WPF project that contains a app.config containing the consection string and tb have a Data layer of type Classlibrary . dot net Standard in which the Migrations folder should be created.…
-
1
votes0
answers133
viewsEntity Code First Migrations does not find Microsoft.EntityFrameworkCore.Design
Hello, I am working on a dotnet 4.5.1 project using Entityframework with Codefirst Migrations, I have added 1 new field to an entity and I am trying to add a new Migration, but the following error…
c# asp.net-mvc .net code-first entity-framework-coreasked 6 years, 11 months ago David oliveira barbosa 11 -
1
votes2
answers65
viewsWhen placing a class in Dbset using Migrations
I have the following classes: public DbSet<Request> Requests { get; set; } public DbSet<Answer> Answers { get; set; } where they have a one-to-Many relationship. When I want a class to…
-
1
votes0
answers36
viewsHow to use Graphdiff Entity Framework Code First
I have the following tables in my database: Sale Detailing Productsresulture Plots The relationship is as follows: 1 Sale => N Detail 1 Sale => N Productsrelations 1 Detail Spreads => N…
-
1
votes1
answer222
viewsMigration does not recognize Context
I’m developing an application using DDD architecture. In my Infra layer, I have my data models, all based on Code First. I’m using the SQL as database. I have installed everything that was needed.…
-
1
votes1
answer32
viewsCode First Generating a foreign key
I have the following classes public class ControleDeVisitas { public virtual ICollection<TipoDeSistemas> TipoDeSistemas { get; set; } } public class TipoDeSistemas { public Guid…
-
0
votes2
answers122
viewsInvalidoperationexception when using the Databasecontext Set method
When using the Dbcontext.Set() method, the following exception is raised: The Entity type is not part of the model for the Current context If I create a Dbset directly in Databasecontext, it works.…
-
0
votes0
answers194
viewsProvider: SQL Network Interfaces, error: 26 - Error Locating Server/Specified Instance
Hello friends, I am making a web application with Entityframework using Codefirst and every time I try to access, add or edit data has given the error below. Can anyone help me? I work with…
-
0
votes1
answer303
viewsdatetime vs dateime2, which is the best?
I’m implementing a new project, using EF6 Codefirst, EF6 creates my database Sql-Server, with date columns as type datetime. What would be the difference between datetime and datetime2, and which is…
-
0
votes1
answer43
viewsConversion of Types with Fluenti API to EF Core 2.1
I would like to know if it is possible to make the following conversion: public class Pessoa { public bool Ativo { get; set; } } public class PessoaMap: IEntityTypeConfiguration<Pessoa> {…
c# asp.net-mvc asp.net-core code-first entity-framework-coreasked 6 years, 6 months ago Nicola Bogar 123 -
0
votes0
answers688
viewsError in Discriminator Column EF code first
I am doing a project in Asp.net, I am using classes in C# to make the connection with the bank, however, every time I try to insert a user in the bank, generates the following error: invalid…
-
0
votes1
answer728
viewsCode first Migrations does not work
I did it in a separate layer called Data public class Context : DbContext { public Context() : base("EscolaContext") { } public DbSet<Escola> Escolas { get; set; } public DbSet<Turma>…
-
0
votes0
answers553
viewsError using Nuget Package Manager in VS 2017
I installed VS 2017 community 2017 and gives this error when I need to use Nuget Package Manager ? PM> enable-migrations enable-migrations : O termo 'enable-migrations' não é reconhecido como…
-
0
votes1
answer287
viewsError saving Entity framework
I have a very basic problem, but I must be short of coffee to understand what is happening. I have such an entity: public class Client : BaseEntity<Client> { [Required] public string…
-
0
votes2
answers598
viewsEntity Framework - When editing, "db. Entry(Category) fails. State = Entitystate.Modified;"
I own a "Category" Entity, which contains id, name, created and updated. I am using Code First. This is my model: public class Category { public int CategoryId { get; set; } public string Name {…
-
0
votes0
answers82
viewsAccess child class properties C#
Using code-first generated the class: namespace take8.Models { using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using…
-
0
votes1
answer100
viewsHow to change and maintain the mapping of classes and properties using ADO.net
When using a database I have tables and columns with names like: - tb_usuario usu_id last name usu_data_nasc - tb_product pro_id pro_name pro_desc_resumida pro_desc_completa When using ADO.NET…
-
0
votes2
answers1109
viewsJson Web Api with error
I have a REST service in WEB API, I use 2 related entities(person and user) relationships 1 = 1, the post to insert this ok, recover the data, searching for the user id as well, but when I try to…
-
0
votes1
answer649
viewsTo change the column name of a table using the Add-Migration Code First Asp.Net MVC command
I have a table already created and I want to change the column name without them being deleted, because it already has a lot of information. I did the procedure of renaming the property Street to…
-
0
votes1
answer59
viewsDependencies with Entityframework C#
My question is how to use the state-class include for parents, because the city-class has no connection with parents. How to perform this sql by loading the dependencies? private void…
-
0
votes0
answers151
viewsASP.MVC ENTITY Code First (odd problem)
I do not know if I am doing something wrong (probably yes). But EF is persisting the data in a BD and in a table that it creates alone. I’ve repeated this step-by-step twice and the result is the…
-
0
votes2
answers84
viewsWays of connection in ASP . NET
I’m a beginner in ASP and C#. I have doubts and this is the real reason to ask here. Before you have to read the politics of questions understand that I am a beginner and I really need help. I have…
-
-3
votes2
answers547
viewsCreate Bank Automatically with Code First
I am creating an ASP.NET MVC application with Code First. This system is trade management software. I’d like to separate the information from each company, not leave it all in the same bank. We…
-
-5
votes2
answers420
viewsHow to extend Pocos from the Entity Framework by encapsulating business rules?
I’m developing a three-layer system. My initial intention was to expose the business layer entities to be used in the repository (EF code first). I want to do this so that I can persist (in memory)…