private void finalizeCodeActivity_Finalize_ExecuteCode(object sender, EventArgs e) { IPageTypeMetaDataTypeLink pageTypeMetaDataTypeLink = this.GetBinding<IPageTypeMetaDataTypeLink>("NewMetaDataTypeLink"); IData newDataTemplate; this.TryGetBinding("NewDataTemplate", out newDataTemplate); string metaDataDefinitionName = this.GetBinding<string>("CompositionDescriptionName"); pageTypeMetaDataTypeLink.Name = metaDataDefinitionName; using (TransactionScope transactionScope = TransactionsFacade.CreateNewScope()) { DataFacade.AddNew<IPageTypeMetaDataTypeLink>(pageTypeMetaDataTypeLink); PageMetaDataFacade.AddDefinition( pageTypeMetaDataTypeLink.PageTypeId, metaDataDefinitionName, this.GetBinding<string>("CompositionDescriptionLabel"), pageTypeMetaDataTypeLink.DataTypeId, this.GetBinding<Guid>("CompositionContainerId") ); if (newDataTemplate != null) { IPageType pageType = DataFacade.GetData<IPageType>().Single(f => f.Id == pageTypeMetaDataTypeLink.PageTypeId); PageMetaDataFacade.AddNewMetaDataToExistingPages(pageType, metaDataDefinitionName, newDataTemplate); } transactionScope.Complete(); } this.RefreshCurrentEntityToken(); }