Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: How do I override the Add Data class / method - Composite c1

$
0
0
I figured this out.... :)

I got help from the following URL
http://docs.composite.net/Data/DataFAQ?q=How+to+attach+events+to+Composite+C1+Data+Stores%3F

Except I edited the code slightly...
public static class MyEventRegistrator
{
    static MyEventRegistrator()
    {
        DataEvents<CMSData.Locations.Cities>.OnAfterUpdate += new DataEventHandler (MyDataAfterAdd);
    }

    public static void Initialize()
    {
        // initialization code is in the static constructor
    }

    private static void MyDataAfterAdd(object sender, DataEventArgs dataEventArgs)
    {
        CMSData.Locations.Cities data = (CMSData.Locations.Cities)dataEventArgs.Data; // A page with data just added

        // Do your magic here
        //LoggingService.LogInformation("MyEventRegistrator", data.);
    }
}

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>