public static ModelTypesDialogInfo GetModelTypesInfo(TextBox entitySetTextBox,
            ComboBox entityComboBox, ComboBox contextComboBox)
        {
            // Validate info
            if (!ValidateRequiredInfo(entitySetTextBox, entityComboBox,
                contextComboBox)) return null;

            // Get info
            string entitiesNamespace = ((ModelTypeInfo) entityComboBox.SelectedItem).Namespace;
            string baseNamespace = entitiesNamespace;
            int namespaceEnd = entitiesNamespace.IndexOf(".Entities.Models", StringComparison.OrdinalIgnoreCase);
            if (namespaceEnd < 0) namespaceEnd = entitiesNamespace.IndexOf(".Entities", StringComparison.OrdinalIgnoreCase);
            if (namespaceEnd >= 0) baseNamespace = entitiesNamespace.Substring(0, namespaceEnd);
            string entityName = ((ModelTypeInfo)entityComboBox.SelectedItem).Name;
            string entitySetName = entitySetTextBox.Text;
            string dbContextName = null;
            if (contextComboBox != null)
            {
                dbContextName = ((ModelTypeInfo) contextComboBox.SelectedItem).Name;
            }
            var info = new ModelTypesDialogInfo
            {
                EntityName = entityName,
                EntitySetName = entitySetName,
                DbContextName = dbContextName,
                BaseNamespace = baseNamespace,
                EntitiesNamespace = entitiesNamespace,
            };
            return info;
        }
 private void okButton_Click(object sender, EventArgs e)
 {
     ModelTypesDialogInfo = ModelTypesHelper.GetModelTypesInfo(entitySetTextBox,
         entityNameComboBox, null);
     if (ModelTypesDialogInfo == null) return;
     DialogResult = DialogResult.OK;
 }
 private void okButton_Click(object sender, EventArgs e)
 {
     ModelTypesDialogInfo = ModelTypesHelper.GetModelTypesInfo(entitySetTextBox,
                                                               entityNameComboBox, null);
     if (ModelTypesDialogInfo == null)
     {
         return;
     }
     DialogResult = DialogResult.OK;
 }
        public static ModelTypesDialogInfo GetModelTypesInfo(TextBox entitySetTextBox,
                                                             ComboBox entityComboBox, ComboBox contextComboBox)
        {
            // Validate info
            if (!ValidateRequiredInfo(entitySetTextBox, entityComboBox,
                                      contextComboBox))
            {
                return(null);
            }

            // Get info
            string entitiesNamespace = ((ModelTypeInfo)entityComboBox.SelectedItem).Namespace;
            string baseNamespace     = entitiesNamespace;
            int    namespaceEnd      = entitiesNamespace.IndexOf(".Entities.Models", StringComparison.OrdinalIgnoreCase);

            if (namespaceEnd < 0)
            {
                namespaceEnd = entitiesNamespace.IndexOf(".Entities", StringComparison.OrdinalIgnoreCase);
            }
            if (namespaceEnd >= 0)
            {
                baseNamespace = entitiesNamespace.Substring(0, namespaceEnd);
            }
            string entityName    = ((ModelTypeInfo)entityComboBox.SelectedItem).Name;
            string entitySetName = entitySetTextBox.Text;
            string dbContextName = null;

            if (contextComboBox != null)
            {
                dbContextName = ((ModelTypeInfo)contextComboBox.SelectedItem).Name;
            }
            var info = new ModelTypesDialogInfo
            {
                EntityName        = entityName,
                EntitySetName     = entitySetName,
                DbContextName     = dbContextName,
                BaseNamespace     = baseNamespace,
                EntitiesNamespace = entitiesNamespace,
            };

            return(info);
        }