WPF & IsValid Property

WPF & IsValid Property

Old forum URL: forums.lhotka.net/forums/t/11852.aspx

clodewyks posted on Monday, February 25, 2013

Hi All,

In my WPF application I have a DataGrid that is bound to a BusinessBindingListBase, I have added a column that will show an image in the DataGrid depending on the IsValid property of each item.

This works fine the first time, but the IsValid property does not notify the UI that it has changed. Is there something I am missing? Is there another property I should be using or a workaround for this issue?

Thanks in advance

JonnyBee replied on Monday, February 25, 2013

You should inherit from BusinessListBase and use the latest version of CSLA.

Latest version of CSLA will give OnPropertyChanged for the metadata properties.  
Earlier version do not give OnPropertyChanged for the metadata properties. 

clodewyks replied on Monday, February 25, 2013



Thanx for the reply, I have updated to version 4.5.10 now using NuGet, but now it seems I cannot Override the Save() method anymore.

Is this intentional? Should I be using something else now?

JonnyBee replied on Monday, February 25, 2013

Look at the change log. 

You must now override SaveAsync method in 4.5.10.

RockfordLhotka replied on Monday, February 25, 2013

The problem was that we'd been sloppy on allowing methods to be virtual, such that lots of methods were virtual, even though they all collapsed behind the scenes into a single point.

In other words, if there are numerous overloads for a method, behind the scenes you'd hope/expect that they all ultimately invoke exactly one of the overloads, and that one overload is the only virtual one.

In the 4.5 data portal everything goes through SaveAsync, so it is the only virtual method.

Even in 4.5.10 there are two virtual overloads, and that'll be fixed in 4.5.20.

clodewyks replied on Tuesday, February 26, 2013


I have updated to version 4.5.10 using NuGet, changed all of my Save() overrides to SaveAsync(boolforceUpdate).

Then I received an error that my app requires the Entity Framework, I went ahead and installed that using NuGet aswell.

Now I get 15 of the following errors:

{" Declaration referenced in a method implementation cannot be a final method.  Type: "X.X.X'.  Assembly: "X, Version=, Culture=neutral, PublicKeyToken=null'.":"X.X.X"}

Any ideas what might be going on here?

RockfordLhotka replied on Tuesday, February 26, 2013

I don't know what triggered the EF dependency.

Jonny, did we have that in 4.5.10? I know it is separated out in 4.5.11+...

I've seen errors like you describe when a nuget package is updated. In those cases I've had to remove and re-add the nuget packages. The worst case was with the Microsoft async targeting pack update - I don't think you can do an in-place update there at all...

clodewyks replied on Wednesday, February 27, 2013

Hi Rocky,

I tried removing CSLA 4.5.10 and EntityFramework packages via NuGet, this is all that has changed before the error started, without any luck. I still get the same amount of errors. What I have found:

"The problem was trying to override a non virtual method."

But SaveAsync(bool forceUpdate) is virtual.

Here is my code to see if there is something that I am doing wrong:

 public override System.Threading.Tasks.Task<Policy> SaveAsync(bool forceUpdate)
      if (!_ignoreBenefitCheck)
        if (!IsNew)
          if (Flags.Count != 0)
            PolicyFlagValidator polValidator = new PolicyFlagValidator();
            BenefitIncreaseFlag benefitValidator = new BenefitIncreaseFlag();
      return base.SaveAsync(forceUpdate);

clodewyks replied on Thursday, February 28, 2013

Hi All,

I've decided to remove all csla references in my projects and replaced them with 4.3.1, then my application works perfectly. I upgraded my projects to .NET 4.5 and added references to 4.5.10 again, via NuGet. Then I receive the above mentioned error.

I get 15 of these errors and thats the same amount as how many overrides I have of the SaveAsync(bool forceUpdate) method.

Any help would be appreciated.



RockfordLhotka replied on Thursday, February 28, 2013

In 4.5.13+ the only virtual SaveAsync method is the protected one that accepts several parameters. You might try overriding that method instead (allowing the IDE to create the new method template) and see if that helps at all.

clodewyks replied on Tuesday, March 05, 2013

I tried overriding only the SaveAsync with multiple parameters, I do reference the EF Framework 5 and yet no change.

I have check all of my overrides within the classes that gives the errors and all of them are still virtual as one site suggested it might be that I am overriding a non-virtual void.

JonnyBee replied on Thursday, February 28, 2013

CSLA 4.5.10 had references to EF 4.3.

clodewyks replied on Tuesday, March 05, 2013

I have found the solution. It can be found here - http://stackoverflow.com/questions/15155312/system-typeloadexception/15218113#15218113

(Sorry for some reason I can't post hyperlinks).

Turns out it was a simple .dll mismatch in my MEF folder.

RockfordLhotka replied on Tuesday, March 05, 2013

I am glad, because I just compiled this successfully :)

  public class TestItem : BusinessBase<TestItem>
    protected override Task<TestItem> SaveAsync(bool forceUpdate, object userState, bool isSync)
      return base.SaveAsync(forceUpdate, userState, isSync);


Copyright (c) Marimer LLC