This project is read-only.

Trigger with object Inheritance

Apr 30, 2013 at 3:57 AM
I have class "A" and register InsertTrigger. And class "B" inherit from "A". When store "B", trigger not be fired. Is that a bug? Because with a large project. Project leader usually define some base class, and all data need inherit it. but all member don't know which class need register which trigger. Or in MVC with multi-programmer, Models define data structure. But Controller may not know what class need register which trigger.

I think maybe the better way is define all trigger as "interface", and not need register trigger. for example when insert object to database. just check object is InsertTrigger. like "if(@object is InsertTrigger) (@Object as InsertTrigger).BeforeInsert(@object);" so this can that trigger have oo's Inheritance and polymorphism.
May 3, 2013 at 8:57 PM
yes indeed, triggers are designed for now in this way, that the registered type is used to fire trigger. Other kind of trigger is the object trigger, which will be fired for all objects.

I agree that here is the place for improvement, please rise the ticket (issue tracker) and I will take a look deeper on that.