protected void SaveChanges(PracticaEFEntities ctx)
        {
            try
            {
                ctx.SaveChanges();
            }
            catch (DbEntityValidationException e)
            {
                System.Diagnostics.Debug.WriteLine("");
                System.Diagnostics.Debug.WriteLine("");
                System.Diagnostics.Debug.WriteLine("**** ENTITY FRAMEWORK DETALLE DE EXCEPCION****");

                foreach (var eve in e.EntityValidationErrors)
                {
                    System.Diagnostics.Debug.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                                       eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        System.Diagnostics.Debug.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                                           ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw;
            }
        }
 public BaseRepository(PracticaEFEntities context)
 {
     ctx   = context;
     dbSet = ctx.Set <T>();
 }
 public ProductoRepository(PracticaEFEntities context) : base(context)
 {
 }
 public MarcaRepository(PracticaEFEntities context) : base(context)
 {
 }
Exemple #5
0
 public LocalRepository(PracticaEFEntities context) : base(context)
 {
 }