diff --git a/OutputDlls/SSD365VSAddIn.dll b/OutputDlls/SSD365VSAddIn.dll
index 85fce6d..ea567eb 100644
Binary files a/OutputDlls/SSD365VSAddIn.dll and b/OutputDlls/SSD365VSAddIn.dll differ
diff --git a/SSD365VSAddIn/.vs/SSD365VSAddIn/v14/.suo b/SSD365VSAddIn/.vs/SSD365VSAddIn/v14/.suo
index e82e963..87fa53f 100644
Binary files a/SSD365VSAddIn/.vs/SSD365VSAddIn/v14/.suo and b/SSD365VSAddIn/.vs/SSD365VSAddIn/v14/.suo differ
diff --git a/SSD365VSAddIn/SSD365VSAddIn/AddinResources.Designer.cs b/SSD365VSAddIn/SSD365VSAddIn/AddinResources.Designer.cs
index 11014c5..538a1c0 100644
--- a/SSD365VSAddIn/SSD365VSAddIn/AddinResources.Designer.cs
+++ b/SSD365VSAddIn/SSD365VSAddIn/AddinResources.Designer.cs
@@ -195,6 +195,15 @@ internal class AddinResources {
}
}
+ ///
+ /// Looks up a localized string similar to Create EDT (SS D365).
+ ///
+ internal static string TableFieldEDTCreatorMenuAddIn {
+ get {
+ return ResourceManager.GetString("TableFieldEDTCreatorMenuAddIn", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to Create Form (SS D365).
///
diff --git a/SSD365VSAddIn/SSD365VSAddIn/AddinResources.resx b/SSD365VSAddIn/SSD365VSAddIn/AddinResources.resx
index f75219d..38faf00 100644
--- a/SSD365VSAddIn/SSD365VSAddIn/AddinResources.resx
+++ b/SSD365VSAddIn/SSD365VSAddIn/AddinResources.resx
@@ -163,6 +163,9 @@
Show the label (SS D365)
+
+ Create EDT (SS D365)
+
Create Form (SS D365)
diff --git a/SSD365VSAddIn/SSD365VSAddIn/SSD365VSAddIn.csproj b/SSD365VSAddIn/SSD365VSAddIn/SSD365VSAddIn.csproj
index aae3404..ae674ed 100644
--- a/SSD365VSAddIn/SSD365VSAddIn/SSD365VSAddIn.csproj
+++ b/SSD365VSAddIn/SSD365VSAddIn/SSD365VSAddIn.csproj
@@ -141,6 +141,7 @@
ModelSettingsUI.cs
+
diff --git a/SSD365VSAddIn/SSD365VSAddIn/Tables/TableFieldEDTCreatorMenuAddIn.cs b/SSD365VSAddIn/SSD365VSAddIn/Tables/TableFieldEDTCreatorMenuAddIn.cs
new file mode 100644
index 0000000..49f10fa
--- /dev/null
+++ b/SSD365VSAddIn/SSD365VSAddIn/Tables/TableFieldEDTCreatorMenuAddIn.cs
@@ -0,0 +1,150 @@
+using Microsoft.Dynamics.AX.Metadata.MetaModel;
+using Microsoft.Dynamics.Framework.Tools.Extensibility;
+using Microsoft.Dynamics.Framework.Tools.MetaModel.Automation.Tables;
+using Microsoft.Dynamics.Framework.Tools.MetaModel.Core;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.Composition;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SSD365VSAddIn.Tables
+{
+ ///
+ /// Creates EDT's for the table field
+ ///
+ [Export(typeof(IDesignerMenu))]
+ // If you need to specify any other element, change this AutomationNodeType value.
+ // You can specify multiple DesignerMenuExportMetadata attributes to meet your needs
+ //[DesignerMenuExportMetadata(AutomationNodeType = typeof(IBaseField))] // once all the other types are created, then Change it to IBaseField
+ [DesignerMenuExportMetadata(AutomationNodeType = typeof(IFieldContainer))]
+ [DesignerMenuExportMetadata(AutomationNodeType = typeof(IFieldDate))]
+ class TableFieldEDTCreatorMenuAddIn : DesignerMenuBase
+ {
+ #region Member variables
+ private const string addinName = "SSD365VSAddIn.TableFieldEDTCreatorMenuAddIn";
+ #endregion
+
+ #region Properties
+ ///
+ /// Caption for the menu item. This is what users would see in the menu.
+ ///
+ public override string Caption
+ {
+ get
+ {
+ return AddinResources.TableFieldEDTCreatorMenuAddIn;
+ }
+ }
+
+ ///
+ /// Unique name of the add-in
+ ///
+ public override string Name
+ {
+ get
+ {
+ return TableFieldEDTCreatorMenuAddIn.addinName;
+ }
+ }
+ #endregion
+
+ #region Callbacks
+ ///
+ /// Called when user clicks on the add-in menu
+ ///
+ /// The context of the VS tools and metadata
+ public override void OnClick(AddinDesignerEventArgs e)
+ {
+ //Microsoft.Dynamics.AX.Metadata.Core.MetaModel.EntryPointType entryPointType;
+ try
+ {
+ // we will create 2 security privileges for the menu item with the same name + Maintain, +View
+ var selectedElement = e.SelectedElement as IBaseField;
+ if (selectedElement != null)
+ {
+ this.CreateEDT(selectedElement);
+ }
+ }
+ catch (Exception ex)
+ {
+ CoreUtility.HandleExceptionWithErrorMessage(ex);
+ }
+ }
+
+ #endregion
+
+ protected void CreateEDT(IBaseField baseField)
+ {
+ if(String.IsNullOrEmpty(baseField.ExtendedDataType) == false)
+ {
+ // There is already a EDT defined for this field
+ return;
+ }
+
+ // The Name of the edt to create should have the prefix as per the Settings
+ // If the Prefix already exists on the
+ var modelSettings = Settings.FetchSettings.FindOrCreateSettings();
+ var edtName = baseField.Name;
+ if(String.IsNullOrEmpty(modelSettings.Prefix) == false
+ && edtName.StartsWith(modelSettings.Prefix, StringComparison.InvariantCultureIgnoreCase) == false)
+ {
+ edtName = modelSettings.Prefix + edtName;
+ }
+ AxEdt edtToCreate = null;
+
+ if(baseField is IFieldContainer)
+ {
+ //var currentField = baseField as IFieldContainer;
+ edtToCreate = new Microsoft.Dynamics.AX.Metadata.MetaModel.AxEdtContainer();
+ }
+ else if (baseField is IFieldDate)
+ {
+ edtToCreate = new Microsoft.Dynamics.AX.Metadata.MetaModel.AxEdtDate();
+ }
+
+ this.copyProperties(baseField, edtToCreate);
+ edtToCreate.Name = edtName;
+
+ if (edtToCreate != null)
+ {
+ // Find current model
+ var modelSaveInfo = Common.CommonUtil.GetCurrentModelSaveInfo();
+
+ //Create menu item in the right model
+ var metaModelProviders = ServiceLocator.GetService(typeof(IMetaModelProviders)) as IMetaModelProviders;
+ var metaModelService = metaModelProviders.CurrentMetaModelService;
+
+ metaModelService.CreateExtendedDataType(edtToCreate, modelSaveInfo);
+
+ //Update the table field with the EDT, also remove any labels from the field
+ baseField.ExtendedDataType = edtToCreate.Name;
+ baseField.Label = String.Empty;
+ baseField.HelpText = String.Empty;
+
+ // Add to the current active project
+ Common.CommonUtil.AddElementToProject(edtToCreate);
+ }
+ }
+ private void copyProperties(object source, object target)
+ {
+ foreach (var prop in source.GetType().GetProperties())
+ {
+ var targetProperty = target.GetType().GetProperty(prop.Name);
+ if (targetProperty != null)
+ {
+ targetProperty.SetValue(target, prop.GetValue(source));
+ }
+ }
+ foreach (var fields in source.GetType().GetFields())
+ {
+ var targetField = target.GetType().GetField(fields.Name);
+ if(targetField != null)
+ {
+ targetField.SetValue(target, fields.GetValue(source));
+ }
+ }
+ }
+ }
+}
diff --git a/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.AddinResources.resources b/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.AddinResources.resources
index a85d9dd..245b033 100644
Binary files a/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.AddinResources.resources and b/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.AddinResources.resources differ
diff --git a/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.csproj.GenerateResource.Cache b/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.csproj.GenerateResource.Cache
index c27c970..c0d5e09 100644
Binary files a/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.csproj.GenerateResource.Cache and b/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.csproj.GenerateResource.Cache differ
diff --git a/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.dll b/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.dll
index 85fce6d..ea567eb 100644
Binary files a/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.dll and b/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.dll differ
diff --git a/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.pdb b/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.pdb
index 350a0f2..4ac670a 100644
Binary files a/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.pdb and b/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/SSD365VSAddIn.pdb differ
diff --git a/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/TempPE/AddinResources.Designer.cs.dll b/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/TempPE/AddinResources.Designer.cs.dll
index 49fa59b..dcdbd21 100644
Binary files a/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/TempPE/AddinResources.Designer.cs.dll and b/SSD365VSAddIn/SSD365VSAddIn/obj/Debug/TempPE/AddinResources.Designer.cs.dll differ