This project is read-only.

How to implement corrupt entity?

Aug 2, 2012 at 12:22 PM

Hi Olmo, 

Is it possible to show an example here or at the website, how to implement corrupt entities? I tried several scenarios but when loading the legacy data the validation keeps complaining about non-valid email addresses.

I have inherited CustomerDN from CorruptEntity
I have copied the code from CorruptEntity into CustomerDN

In the load project I set Corruption.Allowed()



Aug 3, 2012 at 8:57 AM

Hi Nuub, 

You don't need to set Corruction.Allowed(). It's done on the override of IdentifiableIntegrityCheck on CorruptEntity. 

you need, however, to cherry-pick the validations you want to disable for corrupted entities:

* For validations on PropertyCheck, use Corruption.Strict to condition your logic. 

* For attribute validations, at the end of your start method, (and also in the windows side, so maybe is good to factor out the code to some class in the Entities namespace), do something like this:

    .Of((MyEntityDN m) => m.MyProperty)
    .When(m =>Corruption.Strict));  

Hope it helps. 


Note: On the user interface, corruption is not allowed so the WPF controls will complain with a red border, this is by design, you can still save the entity of course.