OnValidate

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
rick.duarte
Posts: 35
Joined: Fri 23 Jan 2009 23:07
Location: Rio de Janeiro, Brazil

OnValidate

Post by rick.duarte » Fri 13 Feb 2009 18:31

The method OnValidate is not firing.
Is it a known bug?

Regards,

Henrique

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 17 Feb 2009 11:01

Thank you for the report, we have reproduced this problem. I will let you know as soon as it is fixed.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 17 Mar 2009 08:10

The problem is fixed, look forward to the next build.

rick.duarte
Posts: 35
Joined: Fri 23 Jan 2009 23:07
Location: Rio de Janeiro, Brazil

Post by rick.duarte » Tue 07 Apr 2009 18:12

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);
        }
    }
}

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 08 Apr 2009 09:49

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.

rick.duarte
Posts: 35
Joined: Fri 23 Jan 2009 23:07
Location: Rio de Janeiro, Brazil

Post by rick.duarte » Wed 08 Apr 2009 12:51

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

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Mon 13 Apr 2009 07:22

Please let me know if the issue is not resolved with the released 5.20.27 build.

Post Reply