Questions tagged as 'entity-framework-6'

1
answer

Problem Returning Items in a Relationship in the Entity Framework

Speak Personal All right!? I'm going through the following problem in the entity framework that I think is some error I'm having at the time of relating two classes: I have a class called: RequestPathPathIndexPath that is related to a clas...
asked by 04.08.2016 / 02:54
5
answers

How to create composite key with Entity Framework 6

I have my base model that all classes inherit from it: public class Base { public int Id {get;set;} public int ClienteId {get;set;} } And an example model: public class Grupo: Base { public string Nome {get;set;} } And a subg...
asked by 12.02.2015 / 13:50
1
answer

How to create default filters with entity framework 6?

I have an Exclude field in several classes and when I go to do my select I always have to impose this condition in the query, is there any way to do the filter implicitly? remembering that it is EF 6. var consulta = this.Contexto.Set<Client...
asked by 18.12.2017 / 19:09
1
answer

Map the same entity twice

I'm trying to map the same entity twice in another public class Conveniado { public int Id { get; set; } public string Nome { get; set; } [InverseProperty(nameof(ProcedimentoAgregado.ConveniadoDe))] public virtual ICollection...
asked by 29.09.2018 / 01:14
1
answer

How to change the type of the persisted class in an inherited model using the EntityFramework

I have the following inheritance classes schema, as an example: public class Veiculo { public int Id { set; get; } public string Descricao { set; get; } } public class Moto : Veiculo { } public class Carro : Veiculo { } That gener...
asked by 02.05.2014 / 04:27
1
answer

'System.StackOverflowException' When executing migration with DbMigrator

I have my Migration which has a number close to 6500 records like this: db.MinhaLista.AddOrUpdate(x => x.Codigo, (new MeuModel { Codigo = "ABC1234", Nome = "Teste "})); However while running my migrations as follows: var migration =...
asked by 26.08.2015 / 20:24
2
answers

Set schema in query with Repository

I have my Repository: public class RepositoryBase<T> where T : class { protected AppDbContext _context; protected IDbSet<T> _dbSet; public RepositoryBase() { _context = _context ?? new AppDbContext();...
asked by 19.11.2014 / 14:27
2
answers

Query by Linq and Lambda getting range of options by sub-query. How to get a result closer to the simple?

Given the following classes: MenuRaiz : public class MenuRaiz { public MenuRaiz() { Menus = new List<Menu>(); } [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] public int Id { get; set; }...
asked by 22.10.2014 / 14:45
1
answer

Entity Framework is not interpreting my settings

I have a serious problem with the Entity Framework . I have two tables: Módulos and Viaturas , both with the name of the primary key ID ( Database First ). A vehicle can have a Module, but it can also be null, the assoc...
asked by 04.09.2018 / 17:42
1
answer

How to know which SQL is generated by the ORM Entity Framework?

With the use of the ORM , and the practice employed we forget that they generate SQLs and return Objetos (vice versa). How can I find out at runtime the SQL generated by the Entity Framework directly in Visual Stud...
asked by 14.06.2014 / 17:48