Questions tagged as 'code-first'

0
answers

Associative entity EF mapping with Fluent API [closed]

I would like to know how to do a mapping without using ICollection , or it might even be using, but I would not want the bank to create a class, just to link the two classes. class Pessoa { public Guid IdPessoa { get; set; } public...
asked by 22.06.2015 / 17:24
2
answers

How to do a Code First migration without deleting data from the table attribute?

I need to change the name of the Weight attribute to Product Weight , this is the code that is generated after running the add-migration command: namespace Web.Dominio.Migrations { using System; using System.Data.Entity.Migrations...
asked by 30.10.2016 / 20:09
2
answers

Many to Many with Fluent API

I'm doing a mapping with Fluent API and a you doubt how I should do the mapping very much. For example, I have the classes below. public partial class Territories { public Territories() { this.Employees = new HashSet<Em...
asked by 15.08.2017 / 15:47
1
answer

Database CodeFirst Entity Framework, 1-0..1, 1-N

I have 3 tables and need to relate them via code (Code First) Iwouldliketoknowhowtodothis.Ialreadyhavethefollowingcodesfromthetables:TbHistoricoAnalogicousingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.IO;usingSystem.Com...
asked by 27.03.2017 / 19:04
1
answer

Associative table mapping with Entity Framework

Abstracting some details I have these classes: public class Department: Entitie { public string Description { get; private set; } public DateTime CreateDate { get; private set; } public virtual ICollection<Service> Services {...
asked by 26.06.2015 / 17:56
1
answer

error left join linq

I can not access the methods of a child class that was created using database first: namespace Dados { using System; using System.Collections.Generic; public partial class pessoa { public pessoa() {...
asked by 01.06.2017 / 14:20
1
answer

Update multiple database using code first without using console

Good afternoon, guys. I have an application that every client owns their database and I'm using code first. To update I'm always running the command update-database -force in the package console for each client database. Does anyone...
asked by 23.08.2016 / 21:26
1
answer

Doubt in studying the Code First development approach

I am currently studying the development approaches used in the Entity Framework 6 approaches Model First and Database First I found the content on the internet easily and I understood, but the Code First approach is really complicated...
asked by 17.12.2015 / 18:34
1
answer

Entity framework many-to-many IEntityChangeTracker error. How to solve?

I have a many-to-many relationship and my tables are correct about the relationship in the database. The problem is that my insert works perfectly when you do not use an existing entity in the database, but when I search the database and add it...
asked by 26.02.2016 / 03:57
1
answer

How NOT to cascade records with 1-n relationship using Entity Framework?

I have a table Menu which can have many Categories and these Categories can only have a Menu : public class Menu { public int Id { get; set; } public string Name { get; set; } public virtual ICollection&l...
asked by 20.08.2015 / 20:07