Good afternoon Srs.
I'm facing a problem I've never seen before, below I have a view mapped in EF with fluent
var viewRelatorio = db.view.where(ra.DataBruta.Month == mesAno.Month).toList();
I have two dictionaries that will interact with the data of this view
var rel1 = new Dictionary<int, Relatorio>();
var relItemVirada = new Dictionary<int, Relatorio>();
var relatorio = new Relatorio>();
var eventoFinal = false
I read the view for iteration with the dictionaries
foreach (var item in viewRelatorio)
{
rel1.Add(i, item);
if (item.HorarioInicial.StartsWith("23") && item.HorarioFinal.StartsWith("00"))
{
relatorio = item;
relatorio.HorarioFinal = "235959";
relItemVirada.Add(i, relatorio);
}
i++;
}
What happens is that every time that I change the value in report. FinalTime it changes the original value in item that does not undergo any kind of change, would like to know what that may be?
I have tried to interact in different ways, different loops, directly in the item, whenever I move in an item affects the next or vice versa
follows the fluent mapping
public RelatorioConfiguration()
: base("name=" + ConfigurationManager.AppSettings["databaseInstance"].ToString())
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
var relatorio = modelBuilder.Entity<Relatorio>();
relatorio.ToTable("view_Relatorio");
relatorio.HasKey(p => new {p.DataBruta, p.HorarioInicial});
relatorio.Property(p => p.Ano);
relatorio.Property(p => p.Classificacao);
relatorio.Property(p => p.DataBruta);
relatorio.Property(p => p.HorarioFinal);
relatorio.Property(p => p.HorarioInicial);
}
public DbSet<Relatorio> Relatorio { get; set; }