private void finalizeStateCodeActivity_ExecuteCode(object sender, EventArgs e) { try { Type oldType = GetOldTypeFromBindings(); string typeName = this.GetBinding <string>(BindingNames.TypeName); string typeNamespace = this.GetBinding <string>(BindingNames.TypeNamespace); string typeTitle = this.GetBinding <string>(BindingNames.TypeTitle); bool hasCaching = this.GetBinding <bool>(BindingNames.HasCaching); bool hasPublishing = this.GetBinding <bool>(BindingNames.HasPublishing); bool isSearchable = this.GetBinding <bool>(BindingNames.IsSearchable); string keyFieldName = this.GetBinding <string>(BindingNames.KeyFieldName); string labelFieldName = this.GetBinding <string>(BindingNames.LabelFieldName); string internalUrlPrefix = this.GetBinding <string>(BindingNames.InternalUrlPrefix); var dataFieldDescriptors = this.GetBinding <List <DataFieldDescriptor> >(BindingNames.DataFieldDescriptors); var helper = new GeneratedTypesHelper(oldType); bool hasLocalization = typeof(ILocalizedControlled).IsAssignableFrom(oldType); string errorMessage; if (!helper.ValidateNewTypeName(typeName, out errorMessage)) { this.ShowFieldMessage(BindingNames.TypeName, errorMessage); return; } if (!helper.ValidateNewTypeNamespace(typeNamespace, out errorMessage)) { this.ShowFieldMessage(BindingNames.TypeNamespace, errorMessage); return; } if (!helper.ValidateNewTypeFullName(typeName, typeNamespace, out errorMessage)) { this.ShowFieldMessage(BindingNames.TypeName, errorMessage); return; } if (!helper.ValidateNewFieldDescriptors(dataFieldDescriptors, keyFieldName, out errorMessage)) { this.ShowMessage( DialogType.Warning, Texts.EditInterfaceTypeStep1_ErrorTitle, errorMessage ); return; } helper.SetNewTypeFullName(typeName, typeNamespace); helper.SetNewTypeTitle(typeTitle); helper.SetNewInternalUrlPrefix(internalUrlPrefix); helper.SetNewFieldDescriptors(dataFieldDescriptors, keyFieldName, labelFieldName); if (helper.IsEditProcessControlledAllowed) { helper.SetCachable(hasCaching); helper.SetSearchable(isSearchable); helper.SetPublishControlled(hasPublishing); helper.SetLocalizedControlled(hasLocalization); } bool originalTypeHasData = DataFacade.HasDataInAnyScope(oldType); if (!helper.TryValidateUpdate(originalTypeHasData, out errorMessage)) { this.ShowMessage( DialogType.Warning, Texts.EditInterfaceTypeStep1_ErrorTitle, errorMessage ); return; } if (!IsPageFolder) { string oldSerializedTypeName = GetSerializedTypeName(GetBinding <string>(BindingNames.OldTypeNamespace), GetBinding <string>(BindingNames.OldTypeName)); string newSerializedTypeName = GetSerializedTypeName(typeNamespace, typeName); if (newSerializedTypeName != oldSerializedTypeName) { UpdateWhiteListedGeneratedTypes(oldSerializedTypeName, newSerializedTypeName); } } helper.CreateType(originalTypeHasData); UpdateBinding(BindingNames.OldTypeName, typeName); UpdateBinding(BindingNames.OldTypeNamespace, typeNamespace); SetSaveStatus(true); var rootEntityToken = new GeneratedDataTypesElementProviderRootEntityToken(this.EntityToken.Source, IsPageFolder ? GeneratedDataTypesElementProviderRootEntityToken.PageDataFolderTypeFolderId : GeneratedDataTypesElementProviderRootEntityToken.GlobalDataTypeFolderId); SpecificTreeRefresher specificTreeRefresher = this.CreateSpecificTreeRefresher(); specificTreeRefresher.PostRefreshMesseges(rootEntityToken); IFile markupFile = DynamicTypesAlternateFormFacade.GetAlternateFormMarkupFile(typeNamespace, typeName); if (markupFile != null) { ShowMessage(DialogType.Message, Texts.FormMarkupInfo_Dialog_Label, Texts.FormMarkupInfo_Message(Texts.EditFormMarkup, markupFile.GetRelativeFilePath())); } } catch (Exception ex) { Log.LogCritical(this.GetType().Name, ex); this.ShowMessage(DialogType.Error, ex.Message, ex.Message); } }