Share This
 
All Posts  /  Kentico Development Tips  /  January 09, 2017 

Kentico Custom Module Development - Ensuring Child Objects Synchronize With Parent Staging Tasks

I recently worked on a project in Kentico 10 that required some custom module development. Some of the classes in the custom module had parent child relationships that needed to be set up programmatically. Since I needed to log tasks for the custom module objects in staging, I needed to ensure that the child objects would synchronize with the parent when the parent was synchronized instead of creating individual tasks for each of the child objects as they were inserted or updated. Unfortunately, the instructions on how to accomplish this were not clear in the documentation. In this post I will show you how to programmatically modify the child classes so that they will synchronize with the parent. 

Parent Info.cs file Type Information section

public static ObjectTypeInfo TYPEINFO = new ObjectTypeInfo(typeof(CompanyInfoProvider), OBJECT_TYPE, 
"CompanyOverview.Company", "CompanyID", "CompanyLastModified", "CompanyGUID", "CompanyName", 
"CompanyDisplayName", null, null, null, null)
{
    ModuleName = "CompanyOverview",
    TouchCacheDependencies = true,   
    SynchronizationSettings =
    {
        LogSynchronization = SynchronizationTypeEnum.LogSynchronization, // Enables logging of staging tasks for changes made to Office objects
        ObjectTreeLocations = new List()
        {
            // Creates a new category in the 'Global objects' section of the staging object tree
            new ObjectTreeLocation(GLOBAL, "CompanyOverview")
        }
    }
};
Child Info.cs Type Information section:

public static ObjectTypeInfo TYPEINFO = new ObjectTypeInfo(typeof(OfficeInfoProvider), OBJECT_TYPE, 
"CompanyOverview.Office", "OfficeID", "OfficeLastModified", "OfficeGUID", "OfficeName", "OfficeDisplayName", 
null, null, null, null)
{
    ParentIDColumn = "CompanyID",
    ParentObjectType = CompanyInfo.OBJECT_TYPE,
    ModuleName = "CompanyOverview", 
    SynchronizationSettings =
    {
        LogSynchronization = SynchronizationTypeEnum.TouchParent, 
        IncludeToSynchronizationParentDataSet = IncludeToParentEnum.Complete,
        
    }
};
Show More
Share This
 
Comments
Blog post currently doesn't have any comments.
*
 Security code
*
ADD COMMENT
Social Buzz

Get in Touch

Contact

Contact
t: 973.539.5255
f: 973.917.4730

Visit

Visit
715 Main Street
Boonton, NJ 07005

Locations

Locations
Boonton
Dallas
Jersey City
Boulder

Send Us a Message




 Security code