OnValidate
-
- Posts: 35
- Joined: Fri 23 Jan 2009 23:07
- Location: Rio de Janeiro, Brazil
OnValidate
The method OnValidate is not firing.
Is it a known bug?
Regards,
Henrique
Is it a known bug?
Regards,
Henrique
-
- Posts: 35
- Joined: Fri 23 Jan 2009 23:07
- Location: Rio de Janeiro, Brazil
The OnValidate method is OK now, but the Insert, Update and Delete methods don't.
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);
}
}
}
-
- Posts: 35
- Joined: Fri 23 Jan 2009 23:07
- Location: Rio de Janeiro, Brazil
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.
As I posted before, my beta version has expired, so I needed to move back to 5.0.26.
Maybe on new version this problem had been solved, but I need to test it before.
Please, post a new beta version or tell us how to extend the trial period.
Regards,
Henrique