0
How can I improve error handling when mapping tables/views? I already solved the error, but I need to e-mail a message with details of the error, as it is not Code First, I end up having these errors direct, because we are 3 developers.
I already have an email sending function, but I don’t know how to insert a Try/catch or something before mapping the tables, can you help me deal with these mapping errors? At times of recording and etc I can naturally treat this, but when mapping these views/tables.
In the case below is a view, and in it had a silly mistake that I’ve already hit, it took me an hour to identify that it was written CODIDO instead of CODE (which is correct):
using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FichaInscricao.Domain;
namespace Fgv.FichaInscricao.Repository.Map
{
public class AreaFuncionalMap : EntityTypeConfiguration<AreaFuncional>
{
public AreaFuncionalMap()
{
ToTable("N_AREA_FUNCIONAL");
HasKey(x => new { x.Codigo, x.CulturaSigla });
Property(x => x.Codigo).HasColumnName("CODIDO");
Property(x => x.Nome).HasColumnName("NOME");
Property(x => x.CulturaSigla).HasColumnName("CULTURA");
}
}
}
I’m using these settings:
- .NET Framework 4.5.1
- Microsoft.AspNet.Mvc 5.2.2
- Oracle 12c
Why you can’t enter the Try catch?
– Leandro Angelo
Strange, was giving error, now it worked! Thanks @Leandroangelo !
– Cristiano Lagame