Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Register IPreUpdateEventListeners only on Entity object #15

Closed
geoffreysmith opened this issue Jun 17, 2011 · 4 comments
Closed

Register IPreUpdateEventListeners only on Entity object #15

geoffreysmith opened this issue Jun 17, 2011 · 4 comments

Comments

@geoffreysmith
Copy link
Member

Should be possible to throw something like this in:

    var entity = @event.Entity as IValidatableObject;
    if (entity == null)
        return false
@shatl
Copy link

shatl commented Jun 22, 2011

As I understand it can validate any object, so
Validator.ValidateObject(@event.Entity, new ValidationContext(entity, null, null), true); should also work

@dwick
Copy link

dwick commented Jun 22, 2011

ValidatableObject also needs to implement IValidatableObject for geoffrey's change to work

@alecwhittington
Copy link
Member

This has been corrected. Closing comments unless someone needs to open it back up.

@MartinHornagold
Copy link

This was fixed for OnPreUpdate but not OnPreInsert

OnPreInsert still has the cast to Entity as shown below:
var entity = (Entity)@event.Entity;

alecwhittington pushed a commit that referenced this issue Oct 11, 2011
The original fix only dealt with OnPreUpdate.
This commit fixes it for OnPreInsert also.
alecwhittington added a commit that referenced this issue Oct 11, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants