Questions tagged as 'entity-framework-6'

1
answer

Code First One to Many May be null

My scenery: public class AlunoAvaliacao { public int AlunoAvaliacaoID { get; set; } public DateTime Inicio { get; set; } public DateTime? Fim { get; set; } public virtual int AvaliacaoID { get; set; }...
asked by 06.12.2014 / 17:01
1
answer

Type conversion error with EntityFramework: Can not convert an object of type 'System.Collections.Generic.HashSet'1 []'

I'm getting this error when trying to write a new record of Atendimento .    Can not convert an object of type 'System.Collections.Generic.HashSet'1 [Domain.AccessAbout]' to type 'Domain.AccessAbout'. Classes: Service : publ...
asked by 28.10.2014 / 13:20
1
answer

Lists do not load next to the model

My model: public class Grupo: ModelBase { public Grupo() { this.Itens = new List<Item>(); } public Grupo(string nome): this() { this.Nome = nome; } public string Nome { get; set; } public v...
asked by 16.09.2014 / 22:25
1
answer

Bank table does not update

I have some tables in my database that already contain saved data, but I can not update this data. I have the method below that performs the insertion of a new item in the table if the table does not have the item, if it has the data that is...
asked by 11.06.2014 / 22:48
1
answer

DbContext: use other connection strings - EntityFramework

I have a web.config file with 4 connection strings. How can I put these connection strings in class DbContext ? public DataContext():base("ConnectionString") // Essa é minha conexão padrão { } How can I do the same with anothe...
asked by 30.07.2014 / 23:22
1
answer

Returned list sorted in BLL?

In my project I use EF6 , I use generic repositories and in my BLL layer I have the ClienteBLL class, which is a class that has the logical implementation methods of the class. In one of the methods I return a list that re...
asked by 24.08.2018 / 22:28
2
answers

When placing a class in DbSet using Migrations

I have the following classes: public DbSet<Request> Requests { get; set; } public DbSet<Answer> Answers { get; set; } being that they have a one-to-many relationship. When I want a class to be added to my EntityFramework migra...
asked by 08.06.2018 / 13:55
1
answer

How to use Include for objects that are within a list

I have the following objects in my EF6 context. public class Produto { public Guid Id {get;set;} public string Nome {get;set;} } public class VedaItem { public int Item {get;set;} public float Valor {get;set;} public Guid...
asked by 20.04.2018 / 21:40
1
answer

Convert SQL to LINQ

I have the following table CREATE TABLE 'ultimaposicaorastreadores' ( 'Id' CHAR(36) COLLATE utf8_bin NOT NULL DEFAULT '', 'Serial' BIGINT(20) NOT NULL, 'DataGps' DATETIME NOT NULL, PRIMARY KEY USING BTREE ('Id', 'DataGps'), KEY 'serial_idx' US...
asked by 11.01.2018 / 17:32
1
answer

Data in duplicate datagrid

I'm developing an application in WPF and when I populate the datagrid via code it returns the duplicate value. I'm using Entity Framework. XAMLCode<DataGridx:Name="dataLocal" Margin="10,111,11,10" IsReadOnly="True" SelectionMode="Single"&...
asked by 03.02.2018 / 01:57