Page 1 of 1

OnValidate

Posted: Fri 13 Feb 2009 18:31
by rick.duarte
The method OnValidate is not firing.
Is it a known bug?

Regards,

Henrique

Posted: Tue 17 Feb 2009 11:01
by AndreyR
Thank you for the report, we have reproduced this problem. I will let you know as soon as it is fixed.

Posted: Tue 17 Mar 2009 08:10
by AndreyR
The problem is fixed, look forward to the next build.

Posted: Tue 07 Apr 2009 18:12
by rick.duarte
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);
        }
    }
}

Posted: Wed 08 Apr 2009 09:49
by AndreyR
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.

Posted: Wed 08 Apr 2009 12:51
by rick.duarte
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.
AndreyR,

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

Posted: Mon 13 Apr 2009 07:22
by AndreyR
Please let me know if the issue is not resolved with the released 5.20.27 build.