Questions tagged as 'entity-framework-6'

1
answer

Dynamic Attributes of an Entity Model

I have a procedure that returns a number of dynamic columns , because this procedure uses the Pivot , then the question arises: How to create a Entity Model for this procedure? Example: public class SProcedure_EF6Context : DbContext {...
asked by 18.05.2017 / 01:51
2
answers

How to use Contains without depending on uppercase and minuscule [duplicate]

Follow the code: var result= db.Table.Where(l => l.Field== value).ToList(); var search = "jOãO pAuLo"; result = result.Where(l => l.Example.Contains(search)).ToList(); It only works like this: João Paulo , if that's the case...
asked by 16.03.2017 / 03:18
1
answer

How to simplify the type declaration with Entity Frameowrk?

I have some tables with several fields of type datetime, and for all of them I need to create a validation in OnModelCreating () for this type, that is, I need to set .HasColumnType("datetime"); , my doubts are; Is there a more practical...
asked by 24.11.2016 / 13:59
1
answer

Entity Framework - Data Access Tips

I'm working on a project using EF6 with C #, in one of my classes I have to save a file, example below: public partial class Arquivo { [Key] public int ArquivoID { get; set; } public string Nome { get; set; }...
asked by 25.02.2016 / 21:47
1
answer

Fluent NxN Mapping of Classes with Compound Key

I have two classes that have composite primary keys, for example: Cliente : public class Cliente { public int EscritorioId { get; set; } public virtual Escritorio Escritorio { get; set; } public int Id { get; set; } }...
asked by 18.08.2015 / 21:00
1
answer

Entity Framework - N for N, clear list

public class Aluno { public int AlunoID { get; set; } public virtual ICollection<Turma> Turmas { get; set; } } public class Turma { public int TurmaID { get; set; } public virtual ICollection<Aluno> Alunos { get; set;...
asked by 29.09.2014 / 14:29
1
answer

Multitenancy with Entity Framework

I have my application, which shares the same database with all my clients. By separating them only by a column of the Empresa_Id table, all my actions, Save, List, Edit, Delete are done by my repository. In my repository I pass the...
asked by 13.10.2014 / 21:28
1
answer

Problem with Linq in Lambda: LINQ to Entities does not recognize ... get_Item (Int32). How to solve?

When trying to execute the loop for (when the query is executed) it is giving error in my lambda expression: var funcionarios = repository.Funcionarios .Include(x => x.Cargo) .Include(x => x.Bairro) .Include(x => x....
asked by 18.08.2014 / 23:48
1
answer

Problem returning Entity models: "The entity or complex type ... can not be constructed in a LINQ to Entities query"

I'm trying to return a list of objects generated by the DataBase First of the Entity Framework but I get this error:   The entity or complex type 'leaosites04Model.TB_LEMBRETES' can not be constructed in a LINQ to Entities query. I'm tryi...
asked by 03.07.2014 / 10:49
1
answer

How to force an Exception when trying to delete a Master record that already contains relationship in a Child Registry?

I have created the following structure in SQL Server: UsingEntityFrameworkwithCode-First,theclasseslooklikethis:[Table("Master")] public class Master { [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] public int Id { get; s...
asked by 18.03.2015 / 16:58