Validator.Unique in the .net code does not work due to ID not being populated

Validator.Unique in the .net code does not work due to ID not being populated

jmo21jmo21 Posts: 13Questions: 3Answers: 0
edited October 2015 in Free community support

As per title, this code currently has a bug as the DtRequest class in DtRequest.cs does not fill it's Ids property.

Downstream, this means that the query that Validator.Unique in Validation.cs fails as host.Id is always equal to null at:

if (host.Action == "edit")
{
      query.Where(host.Editor.Pkey(), host.Id, "!=");
}

I managed to fix this myself by editing the downloaded code.

I added the following in DtRequest.cs which works for my basic case for the moment:

else if (Action == "edit")
{
       RequestType = RequestTypes.EditorEdit;
       Data = http["data"] as Dictionary<string, object>;

       Data.Keys.ToList().ForEach(f => Ids.Add(f.Substring(4))); //**** added this line
 }

Note: I am currently evaluating with the free trial, I assume the code you get with that is the most uptodate.

Replies

  • allanallan Posts: 62,296Questions: 1Answers: 10,214 Site admin

    Hi,

    Thanks for noting this. Yes, unfortunately this is a bug that is present in the current release of Editor for both the PHP and .NET libraries. It has been fixed and will be in the next release (1.5.2) which I expect to be out next week.

    Good to hear you have a workaround for now!

    Regards,
    Allan

  • jmo21jmo21 Posts: 13Questions: 3Answers: 0

    sweet, thanks Allan!

This discussion has been closed.