OnValidate
Posted: Fri 13 Feb 2009 18:31
The method OnValidate is not firing.
Is it a known bug?
Regards,
Henrique
Is it a known bug?
Regards,
Henrique
Discussion forums for open issues and questions concerning database tools, data access components and developer tools from Devart
https://forums.devart.com/
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
namespace ARGUS.db
{
public partial class ARGUSDataContext
{
partial void InsertAgenteSolucionadorARS(AgenteSolucionadorARS instance)
{
if (AgenteSolucionadorARS.Count(q => q.CdAgenteSolucionadorARS == instance.CdAgenteSolucionadorARS) > 0)
throw new ApplicationException("Código já cadastrado.");
if (AgenteSolucionadorARS.Count(q => q.NmAgenteSolucionadorARS == instance.NmAgenteSolucionadorARS) > 0)
throw new ApplicationException("Nome já cadastrado.");
ExecuteDynamicInsert(instance);
}
partial void UpdateAgenteSolucionadorARS(AgenteSolucionadorARS instance)
{
List lista = AgenteSolucionadorARS.Where(q => q.NmAgenteSolucionadorARS == instance.NmAgenteSolucionadorARS).ToList();
if (lista.Count > 0 && lista.Find(q => q.CdAgenteSolucionadorARS != instance.CdAgenteSolucionadorARS) != null)
throw new ApplicationException("Nome já cadastrado.");
ExecuteDynamicUpdate(instance);
}
}
}
AndreyR,AndreyR wrote:Please send us (support * devart * com, subject "LINQ: Insert/Update problems") a small test project illustrating the problem.
I have just tried with 5.20.24 Beta version and everything succeeded.
Please note that these methods are executed after the SubmitChanges() method call only.