@@ -31,6 +31,8 @@ public class CloneFieldDefinitionsControl : PluginControlBase
3131 private ColumnHeader columnHeader5 ;
3232 private Label label3 ;
3333 private TextBox txtPrefix ;
34+ private Label prefixOverrideLabel ;
35+ private CheckBox prefixOverride ;
3436 private readonly List < EntityMetadata > _entitiesDetailed ;
3537
3638
@@ -102,6 +104,8 @@ private void InitializeComponent()
102104 this . button1 = new System . Windows . Forms . Button ( ) ;
103105 this . label3 = new System . Windows . Forms . Label ( ) ;
104106 this . txtPrefix = new System . Windows . Forms . TextBox ( ) ;
107+ this . prefixOverrideLabel = new System . Windows . Forms . Label ( ) ;
108+ this . prefixOverride = new System . Windows . Forms . CheckBox ( ) ;
105109 this . listView1 = new System . Windows . Forms . ListView ( ) ;
106110 this . columnHeader1 = ( ( System . Windows . Forms . ColumnHeader ) ( new System . Windows . Forms . ColumnHeader ( ) ) ) ;
107111 this . columnHeader3 = ( ( System . Windows . Forms . ColumnHeader ) ( new System . Windows . Forms . ColumnHeader ( ) ) ) ;
@@ -122,6 +126,7 @@ private void InitializeComponent()
122126 this . flowLayoutPanel2 . Controls . Add ( this . button1 ) ;
123127 this . flowLayoutPanel2 . Controls . Add ( this . label3 ) ;
124128 this . flowLayoutPanel2 . Controls . Add ( this . txtPrefix ) ;
129+ this . flowLayoutPanel2 . Controls . Add ( this . prefixOverride ) ;
125130 this . flowLayoutPanel2 . Location = new System . Drawing . Point ( 3 , 3 ) ;
126131 this . flowLayoutPanel2 . Name = "flowLayoutPanel2" ;
127132 this . flowLayoutPanel2 . Size = new System . Drawing . Size ( 1129 , 39 ) ;
@@ -193,6 +198,18 @@ private void InitializeComponent()
193198 this . txtPrefix . Size = new System . Drawing . Size ( 100 , 20 ) ;
194199 this . txtPrefix . TabIndex = 5 ;
195200 //
201+ // prefixOverride Label
202+ //
203+ this . prefixOverrideLabel . AutoSize = true ;
204+ this . prefixOverrideLabel . Name = "prefixOverrideLabel" ;
205+ this . prefixOverrideLabel . TabIndex = 7 ;
206+ this . prefixOverrideLabel . Text = "Override Prefix" ;
207+ //
208+ // prefixOverride
209+ //
210+ this . prefixOverride . Name = "prefixOverride" ;
211+ this . prefixOverride . TabIndex = 8 ;
212+ //
196213 // listView1
197214 //
198215 this . listView1 . Alignment = System . Windows . Forms . ListViewAlignment . SnapToGrid ;
@@ -391,11 +408,17 @@ private void CloneFields(List<string> fields, string sourceEntityName, string ta
391408 AttributeTypeCode . Owner
392409 } . Contains ( attribute . AttributeType . Value ) ;
393410
411+ var textPrefix = txtPrefix . Text . Replace ( "_" , "" ) ;
394412 if ( ! attribute . IsCustomAttribute . Value )
395413 {
396- attribute . LogicalName = String . Format ( "{0}_{1}" , txtPrefix . Text . Replace ( "_" , "" ) , attribute . LogicalName ) . ToLower ( ) ;
397- attribute . SchemaName = String . Format ( "{0}_{1}" , txtPrefix . Text . Replace ( "_" , "" ) , attribute . SchemaName ) . ToLower ( ) ;
414+ attribute . LogicalName = String . Format ( "{0}_{1}" , textPrefix , attribute . LogicalName ) . ToLower ( ) ;
415+ attribute . SchemaName = String . Format ( "{0}_{1}" , textPrefix , attribute . SchemaName ) . ToLower ( ) ;
416+ }
398417
418+ if ( this . prefixOverride . Checked )
419+ {
420+ attribute . LogicalName = String . Format ( "{0}_{1}" , textPrefix , attribute . LogicalName . Substring ( attribute . LogicalName . IndexOf ( '_' ) + 1 ) ) . ToLower ( ) ;
421+ attribute . SchemaName = String . Format ( "{0}_{1}" , textPrefix , attribute . SchemaName . Substring ( attribute . SchemaName . IndexOf ( '_' ) + 1 ) ) . ToLower ( ) ;
399422 }
400423
401424 if ( ! isEntityReference )
0 commit comments