private void GenerateStateEnums(StateAttributeMetadata stateAttr, StatusAttributeMetadata statusAttr)
        {
            WriteLine();
            WriteLine("'StateCodes': {");

            var options = CreateFileHandler.GetStateOptionItems(statusAttr, stateAttr, this._listStringMap);

            WriteLine();

            // Формируем значения
            foreach (var item in options)
            {
                WriteLine(item.MakeStringJS());
            }

            WriteLine("},");
        }
        private void GenerateStatusEnums(StatusAttributeMetadata statusAttr, StateAttributeMetadata stateAttr)
        {
            WriteLine();
            WriteLine("'StatusCodes': {");

            var options = CreateFileHandler.GetStatusOptionItems(statusAttr, stateAttr, this._listStringMap);

            WriteLine();

            // Формируем значения
            foreach (var item in options.OrderBy(op => op.LinkedStateCode).ThenBy(op => op.Value))
            {
                WriteLine(item.MakeStringJS());
            }

            WriteLine("},");
        }
示例#3
0
        private async Task GenerateOptionSetEnums(string tempNamespace, OptionSetMetadata optionSet)
        {
            var dependent = await _dependencyRepository.GetDependentComponentsAsync((int)ComponentType.OptionSet, optionSet.MetadataId.Value);

            string           entityname    = null;
            string           attributename = null;
            List <StringMap> listStringmap = null;

            if (dependent.Any(e => e.DependentComponentType.Value == (int)ComponentType.Attribute))
            {
                var attr = dependent.FirstOrDefault(e => e.DependentComponentType.Value == (int)ComponentType.Attribute);

                var attributeMetadata = _descriptor.MetadataSource.GetAttributeMetadata(attr.DependentComponentObjectId.Value);

                if (attributeMetadata != null)
                {
                    entityname    = attributeMetadata.EntityLogicalName;
                    attributename = attributeMetadata.LogicalName;

                    listStringmap = await _repositoryStringMap.GetListAsync(entityname);
                }
            }

            var options = CreateFileHandler.GetOptionItems(entityname, attributename, optionSet, listStringmap);

            if (!options.Any())
            {
                return;
            }

            WriteLine();

            if (this._withDependentComponents)
            {
                var desc = await _descriptorHandler.GetDescriptionDependentAsync(dependent);

                var split = desc.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

                foreach (var item in split)
                {
                    WriteLine("// {0}", item);
                }
            }

            string objectName = string.Format("{0}{1}Enum", tempNamespace, optionSet.Name);

            if (CreateFileHandler.IgnoreGlobalOptionSet(optionSet.Name))
            {
                WriteLine("// {0}", objectName);
                return;
            }

            WriteLine(string.Format("{0} =", objectName) + " {");

            WriteLine();

            // Формируем значения
            foreach (var item in options)
            {
                WriteLine(item.MakeStringJS());
            }

            WriteLine("};");
        }
        private async Task <List <string> > GetDifferenceAttribute(AttributeMetadata attr1, AttributeMetadata attr2)
        {
            List <string> strDifference = new List <string>();

            {
                FormatTextTableHandler table = new FormatTextTableHandler(true);

                table.CalculateLineLengths("LanguageCode", "Value");
                table.CalculateLineLengths("LanguageCode", "Organization", "Value");

                var isDifferentDisplayName = LabelComparer.GetDifference(attr1.DisplayName, attr2.DisplayName);
                var isDifferentDescription = LabelComparer.GetDifference(attr1.Description, attr2.Description);

                isDifferentDisplayName.LabelsOnlyIn1.ForEach(i => table.CalculateLineLengths(i.Locale, i.Value));
                isDifferentDisplayName.LabelsOnlyIn2.ForEach(i => table.CalculateLineLengths(i.Locale, i.Value));
                isDifferentDisplayName.LabelDifference.ForEach(i =>
                {
                    table.CalculateLineLengths(i.Locale, _connectionName1, i.Value1);
                    table.CalculateLineLengths(i.Locale, _connectionName2, i.Value2);
                });

                isDifferentDescription.LabelsOnlyIn1.ForEach(i => table.CalculateLineLengths(i.Locale, i.Value));
                isDifferentDescription.LabelsOnlyIn2.ForEach(i => table.CalculateLineLengths(i.Locale, i.Value));
                isDifferentDescription.LabelDifference.ForEach(i =>
                {
                    table.CalculateLineLengths(i.Locale, _connectionName1, i.Value1);
                    table.CalculateLineLengths(i.Locale, _connectionName2, i.Value2);
                });

                if (!isDifferentDisplayName.IsEmpty)
                {
                    if (isDifferentDisplayName.LabelsOnlyIn1.Count > 0)
                    {
                        strDifference.Add(string.Format("DisplayNames ONLY in {0}: {1}", _connectionName1, isDifferentDisplayName.LabelsOnlyIn1.Count));
                        strDifference.Add(_tabSpacer + table.FormatLine("LanguageCode", "Value"));
                        isDifferentDisplayName.LabelsOnlyIn1.ForEach(e => strDifference.Add(_tabSpacer + table.FormatLine(e.Locale, e.Value)));
                    }

                    if (isDifferentDisplayName.LabelsOnlyIn2.Count > 0)
                    {
                        strDifference.Add(string.Format("DisplayNames ONLY in {0}: {1}", _connectionName2, isDifferentDisplayName.LabelsOnlyIn2.Count));
                        strDifference.Add(_tabSpacer + table.FormatLine("LanguageCode", "Value"));
                        isDifferentDisplayName.LabelsOnlyIn2.ForEach(e => strDifference.Add(_tabSpacer + table.FormatLine(e.Locale, e.Value)));
                    }

                    if (isDifferentDisplayName.LabelDifference.Count > 0)
                    {
                        strDifference.Add(string.Format("DisplayNames DIFFERENT in {0} and {1}: {2}", _connectionName1, _connectionName2, isDifferentDisplayName.LabelDifference.Count));
                        strDifference.Add(_tabSpacer + table.FormatLine("LanguageCode", "Organization", "Value"));
                        isDifferentDisplayName.LabelDifference.ForEach(i =>
                        {
                            strDifference.Add(_tabSpacer + table.FormatLine(i.Locale, _connectionName1, i.Value1));
                            strDifference.Add(_tabSpacer + table.FormatLine(i.Locale, _connectionName2, i.Value2));
                        });
                    }
                }

                if (!isDifferentDescription.IsEmpty)
                {
                    if (isDifferentDescription.LabelsOnlyIn1.Count > 0)
                    {
                        strDifference.Add(string.Format("Descriptions ONLY in {0}: {1}", _connectionName1, isDifferentDescription.LabelsOnlyIn1.Count));
                        strDifference.Add(_tabSpacer + table.FormatLine("LanguageCode", "Value"));
                        isDifferentDescription.LabelsOnlyIn1.ForEach(e => strDifference.Add(_tabSpacer + table.FormatLine(e.Locale, e.Value)));
                    }

                    if (isDifferentDescription.LabelsOnlyIn2.Count > 0)
                    {
                        strDifference.Add(string.Format("Descriptions ONLY in {0}: {1}", _connectionName2, isDifferentDescription.LabelsOnlyIn2.Count));
                        strDifference.Add(_tabSpacer + table.FormatLine("LanguageCode", "Value"));
                        isDifferentDescription.LabelsOnlyIn2.ForEach(e => strDifference.Add(_tabSpacer + table.FormatLine(e.Locale, e.Value)));
                    }

                    if (isDifferentDescription.LabelDifference.Count > 0)
                    {
                        strDifference.Add(string.Format("Descriptions DIFFERENT in {0} and {1}: {2}", _connectionName1, _connectionName2, isDifferentDescription.LabelDifference.Count));
                        strDifference.Add(_tabSpacer + table.FormatLine("LanguageCode", "Organization", "Value"));
                        isDifferentDescription.LabelDifference.ForEach(i =>
                        {
                            strDifference.Add(_tabSpacer + table.FormatLine(i.Locale, _connectionName1, i.Value1));
                            strDifference.Add(_tabSpacer + table.FormatLine(i.Locale, _connectionName2, i.Value2));
                        });
                    }
                }
            }

            {
                var table = new FormatTextTableHandler(true);
                table.SetHeader("Property", _connectionName1, _connectionName2);

                List <string> additionalDifference = new List <string>();

                if (attr1.GetType().Name == attr2.GetType().Name)
                {
                    if (attr1 is Microsoft.Xrm.Sdk.Metadata.EnumAttributeMetadata)
                    {
                        var enumAttributeMetadata1 = attr1 as Microsoft.Xrm.Sdk.Metadata.EnumAttributeMetadata;
                        var enumAttributeMetadata2 = attr2 as Microsoft.Xrm.Sdk.Metadata.EnumAttributeMetadata;

                        if (enumAttributeMetadata1.OptionSet != null && enumAttributeMetadata2.OptionSet != null)
                        {
                            if (!CreateFileHandler.IgnoreAttribute(enumAttributeMetadata1.EntityLogicalName, enumAttributeMetadata1.LogicalName))
                            {
                                var diffenrenceOptionSet = await _optionSetComparer.GetDifference(enumAttributeMetadata1.OptionSet, enumAttributeMetadata2.OptionSet, attr1.EntityLogicalName, attr1.LogicalName);

                                if (diffenrenceOptionSet.Count > 0)
                                {
                                    additionalDifference.Add(string.Format("Difference in OptionSet {0} and {1}"
                                                                           , enumAttributeMetadata1.OptionSet.Name + (enumAttributeMetadata1.OptionSet.IsGlobal.GetValueOrDefault() ? "(Global)" : "(Local)")
                                                                           , enumAttributeMetadata2.OptionSet.Name + (enumAttributeMetadata2.OptionSet.IsGlobal.GetValueOrDefault() ? "(Global)" : "(Local)")
                                                                           )
                                                             );
                                    diffenrenceOptionSet.ForEach(s => additionalDifference.Add(_tabSpacer + s));
                                }
                            }
                        }
                    }
                }

                if (table.Count > 0)
                {
                    strDifference.AddRange(table.GetFormatedLines(true));
                }

                if (additionalDifference.Count > 0)
                {
                    strDifference.AddRange(additionalDifference);
                }
            }

            return(strDifference);
        }
        private async Task GenerateOptionSetEnums(IEnumerable <AttributeMetadata> attributeList, OptionSetMetadata optionSet)
        {
            var options = CreateFileHandler.GetOptionItems(attributeList.First().EntityLogicalName, attributeList.First().LogicalName, optionSet, this._listStringMap);

            if (!options.Any())
            {
                return;
            }

            WriteLine();

            WriteLine("// Attribute:");
            foreach (var attr in attributeList.OrderBy(a => a.LogicalName))
            {
                WriteLine("// " + _tabSpacer + attr.LogicalName);
            }

            if (optionSet.IsGlobal.GetValueOrDefault() && this._config.WithDependentComponents)
            {
                var coll = await _dependencyRepository.GetDependentComponentsAsync((int)ComponentType.OptionSet, optionSet.MetadataId.Value);

                var desc = await _descriptorHandler.GetDescriptionDependentAsync(coll);

                var split = desc.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

                if (split.Any())
                {
                    WriteSummaryStrings(split);
                }
            }

            bool ignore = attributeList.Any(a => IgnoreAttribute(_entityMetadata.LogicalName, a.LogicalName));

            if (ignore)
            {
                foreach (var attr in attributeList.OrderBy(a => a.LogicalName))
                {
                    WriteLine("//var {0}Enum", attr.LogicalName);
                }
                return;
            }

            var enumName = string.Empty;

            if (optionSet.IsGlobal.GetValueOrDefault())
            {
                enumName = optionSet.Name;
            }
            else
            {
                enumName = attributeList.First().LogicalName;
            }

            WriteLine(string.Format("'{0}Enum':", enumName) + " {");

            WriteLine();

            // Формируем значения
            foreach (var item in options)
            {
                WriteLine(item.MakeStringJS());
            }

            WriteLine("},");
        }
示例#6
0
        private async Task GenerateOptionSetEnums(OptionSetMetadata optionSet)
        {
            var dependent = await _dependencyRepository.GetDependentComponentsAsync((int)ComponentType.OptionSet, optionSet.MetadataId.Value);

            string           entityname    = null;
            string           attributename = null;
            List <StringMap> listStringmap = null;

            if (dependent.Any(e => e.DependentComponentType.Value == (int)ComponentType.Attribute))
            {
                var attr = dependent.FirstOrDefault(e => e.DependentComponentType.Value == (int)ComponentType.Attribute);

                var attributeMetadata = _descriptor.MetadataSource.GetAttributeMetadata(attr.DependentComponentObjectId.Value);

                if (attributeMetadata != null)
                {
                    entityname    = attributeMetadata.EntityLogicalName;
                    attributename = attributeMetadata.LogicalName;

                    listStringmap = await _repositoryStringMap.GetListAsync(entityname);
                }
            }

            WriteLine();

            List <string> headers = new List <string>();

            string temp = string.Format("OptionSet Name: {0}      IsCustomOptionSet: {1}", optionSet.Name, optionSet.IsCustomOptionSet);

            if (this._config.WithManagedInfo)
            {
                temp += string.Format("      IsManaged: {0}", optionSet.IsManaged);
            }
            headers.Add(temp);

            if (this._config.WithDependentComponents)
            {
                var desc = await _descriptorHandler.GetDescriptionDependentAsync(dependent);

                var split = desc.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

                if (split.Any())
                {
                    headers.Add(string.Empty);

                    foreach (var item in split)
                    {
                        headers.Add(item);
                    }
                }
            }

            WriteSummary(optionSet.DisplayName, optionSet.Description, null, headers);

            var options = CreateFileHandler.GetOptionItems(entityname, attributename, optionSet, listStringmap);

            {
                bool ignore = CreateFileHandler.IgnoreGlobalOptionSet(optionSet.Name) || !options.Any();

                if (!ignore)
                {
                    if (this._config.AddDescriptionAttribute)
                    {
                        string description = CreateFileHandler.GetLocalizedLabel(optionSet.DisplayName);

                        if (string.IsNullOrEmpty(description))
                        {
                            description = CreateFileHandler.GetLocalizedLabel(optionSet.Description);
                        }

                        if (!string.IsNullOrEmpty(description))
                        {
                            WriteLine("[System.ComponentModel.DescriptionAttribute(\"{0}\")]", description);
                        }
                    }

                    if (this._config.OptionSetExportType == OptionSetExportType.Enums && _config.AddTypeConverterAttributeForEnums && !string.IsNullOrEmpty(_config.TypeConverterName))
                    {
                        WriteLine("[System.ComponentModel.TypeConverterAttribute(\"{0}\")]", _config.TypeConverterName);
                    }
                }

                StringBuilder str = new StringBuilder();

                if (ignore)
                {
                    str.Append("// ");
                }

                if (this._config.OptionSetExportType == OptionSetExportType.Enums)
                {
                    str.AppendFormat("public enum {0}", optionSet.Name);
                }
                else
                {
                    str.AppendFormat("public static partial class {0}", optionSet.Name);
                }

                WriteLine(str.ToString());

                if (ignore)
                {
                    return;
                }
            }

            WriteLine("{");

            bool first = true;

            // Формируем значения
            foreach (var item in options)
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    WriteLine();
                }

                List <string> header = new List <string>()
                {
                    item.Value.ToString()
                };

                if (item.DisplayOrder.HasValue)
                {
                    header.Add(string.Format("DisplayOrder: {0}", item.DisplayOrder.Value));
                }

                WriteSummary(item.Label, item.Description, header, null);

                if (this._config.AddDescriptionAttribute)
                {
                    string description = CreateFileHandler.GetLocalizedLabel(item.Label);

                    if (string.IsNullOrEmpty(description))
                    {
                        description = CreateFileHandler.GetLocalizedLabel(item.Description);
                    }

                    if (!string.IsNullOrEmpty(description))
                    {
                        WriteLine("[System.ComponentModel.DescriptionAttribute(\"{0}\")]", description);
                    }
                }

                var str = item.MakeStrings();

                if (this._config.OptionSetExportType == OptionSetExportType.Enums)
                {
                    WriteLine("[System.Runtime.Serialization.EnumMemberAttribute()]");

                    WriteLine(str + ",");
                }
                else
                {
                    WriteLine("public {0} int {1};", _fieldHeader, str);
                }
            }

            WriteLine("}");
        }
示例#7
0
        public async Task <List <string> > GetDifference(OptionSetMetadata optionSet1, OptionSetMetadata optionSet2, string entityName1, string attributeName1, string entityName2 = null, string attributeName2 = null)
        {
            List <string> strDifference = new List <string>();

            {
                FormatTextTableHandler table = new FormatTextTableHandler(true);

                table.CalculateLineLengths("LanguageCode", "Value");
                table.CalculateLineLengths("LanguageCode", "Organization", "Value");

                var isDifferentDisplayName = LabelComparer.GetDifference(optionSet1.DisplayName, optionSet2.DisplayName);
                var isDifferentDescription = LabelComparer.GetDifference(optionSet1.Description, optionSet2.Description);

                isDifferentDisplayName.LabelsOnlyIn1.ForEach(i => table.CalculateLineLengths(i.Locale, i.Value));
                isDifferentDisplayName.LabelsOnlyIn2.ForEach(i => table.CalculateLineLengths(i.Locale, i.Value));
                isDifferentDisplayName.LabelDifference.ForEach(i =>
                {
                    table.CalculateLineLengths(i.Locale, _connectionName1, i.Value1);
                    table.CalculateLineLengths(i.Locale, _connectionName2, i.Value2);
                });

                isDifferentDescription.LabelsOnlyIn1.ForEach(i => table.CalculateLineLengths(i.Locale, i.Value));
                isDifferentDescription.LabelsOnlyIn2.ForEach(i => table.CalculateLineLengths(i.Locale, i.Value));
                isDifferentDescription.LabelDifference.ForEach(i =>
                {
                    table.CalculateLineLengths(i.Locale, _connectionName1, i.Value1);
                    table.CalculateLineLengths(i.Locale, _connectionName2, i.Value2);
                });

                if (!isDifferentDisplayName.IsEmpty)
                {
                    if (isDifferentDisplayName.LabelsOnlyIn1.Count > 0)
                    {
                        strDifference.Add(string.Format("DisplayNames ONLY in {0}: {1}", _connectionName1, isDifferentDisplayName.LabelsOnlyIn1.Count));
                        strDifference.Add(_tabSpacer + table.FormatLine("LanguageCode", "Value"));
                        isDifferentDisplayName.LabelsOnlyIn1.ForEach(e => strDifference.Add(_tabSpacer + table.FormatLine(e.Locale, e.Value)));
                    }

                    if (isDifferentDisplayName.LabelsOnlyIn2.Count > 0)
                    {
                        strDifference.Add(string.Format("DisplayNames ONLY in {0}: {1}", _connectionName2, isDifferentDisplayName.LabelsOnlyIn2.Count));
                        strDifference.Add(_tabSpacer + table.FormatLine("LanguageCode", "Value"));
                        isDifferentDisplayName.LabelsOnlyIn2.ForEach(e => strDifference.Add(_tabSpacer + table.FormatLine(e.Locale, e.Value)));
                    }

                    if (isDifferentDisplayName.LabelDifference.Count > 0)
                    {
                        strDifference.Add(string.Format("DisplayNames DIFFERENT in {0} and {1}: {2}", _connectionName1, _connectionName2, isDifferentDisplayName.LabelDifference.Count));
                        strDifference.Add(_tabSpacer + table.FormatLine("LanguageCode", "Organization", "Value"));
                        isDifferentDisplayName.LabelDifference.ForEach(i =>
                        {
                            strDifference.Add(_tabSpacer + table.FormatLine(i.Locale, _connectionName1, i.Value1));
                            strDifference.Add(_tabSpacer + table.FormatLine(i.Locale, _connectionName2, i.Value2));
                        });
                    }
                }

                if (!isDifferentDescription.IsEmpty)
                {
                    if (isDifferentDescription.LabelsOnlyIn1.Count > 0)
                    {
                        strDifference.Add(string.Format("Descriptions ONLY in {0}: {1}", _connectionName1, isDifferentDescription.LabelsOnlyIn1.Count));
                        strDifference.Add(_tabSpacer + table.FormatLine("LanguageCode", "Value"));
                        isDifferentDescription.LabelsOnlyIn1.ForEach(e => strDifference.Add(_tabSpacer + table.FormatLine(e.Locale, e.Value)));
                    }

                    if (isDifferentDescription.LabelsOnlyIn2.Count > 0)
                    {
                        strDifference.Add(string.Format("Descriptions ONLY in {0}: {1}", _connectionName2, isDifferentDescription.LabelsOnlyIn2.Count));
                        strDifference.Add(_tabSpacer + table.FormatLine("LanguageCode", "Value"));
                        isDifferentDescription.LabelsOnlyIn2.ForEach(e => strDifference.Add(_tabSpacer + table.FormatLine(e.Locale, e.Value)));
                    }

                    if (isDifferentDescription.LabelDifference.Count > 0)
                    {
                        strDifference.Add(string.Format("Descriptions DIFFERENT in {0} and {1}: {2}", _connectionName1, _connectionName2, isDifferentDescription.LabelDifference.Count));
                        strDifference.Add(_tabSpacer + table.FormatLine("LanguageCode", "Organization", "Value"));
                        isDifferentDescription.LabelDifference.ForEach(i =>
                        {
                            strDifference.Add(_tabSpacer + table.FormatLine(i.Locale, _connectionName1, i.Value1));
                            strDifference.Add(_tabSpacer + table.FormatLine(i.Locale, _connectionName2, i.Value2));
                        });
                    }
                }
            }

            {
                var table = new FormatTextTableHandler(true);
                table.SetHeader("Property", _connectionName1, _connectionName2);

                table.AddLineIfNotEqual("IsCustomizable", optionSet1.IsCustomizable, optionSet2.IsCustomizable);
                table.AddLineIfNotEqual("IsCustomOptionSet", optionSet1.IsCustomOptionSet, optionSet2.IsCustomOptionSet);
                table.AddLineIfNotEqual("IsGlobal", optionSet1.IsGlobal, optionSet2.IsGlobal);
                //table.AddLineIfNotEqual("IsManaged", optionSet1.IsManaged, optionSet2.IsManaged);
                table.AddLineIfNotEqual("Name", optionSet1.Name, optionSet2.Name);

                if (table.Count > 0)
                {
                    strDifference.AddRange(table.GetFormatedLines(true));
                }
            }

            {
                var optionValueOnly1 = new Dictionary <Tuple <int, bool?>, List <string> >();
                var optionValueOnly2 = new Dictionary <Tuple <int, bool?>, List <string> >();

                var optionValueDifferent = new Dictionary <int, List <string> >();

                foreach (var optionMetadata1 in optionSet1.Options.Where(e => e.Value.HasValue).OrderBy(e => e.Value))
                {
                    {
                        var optionMetadata2 = optionSet2.Options.FirstOrDefault(e => e.Value.HasValue && e.Value == optionMetadata1.Value);

                        if (optionMetadata2 != null)
                        {
                            continue;
                        }
                    }

                    List <string> listStrings = new List <string>();

                    CreateFileHandler.FillLabelDisplayNameAndDescription(listStrings, true, optionMetadata1.Label, optionMetadata1.Description, _tabSpacer);

                    optionValueOnly1.Add(Tuple.Create(optionMetadata1.Value.Value, optionMetadata1.IsManaged), listStrings);
                }

                foreach (var optionMetadata2 in optionSet2.Options.Where(e => e.Value.HasValue).OrderBy(e => e.Value))
                {
                    {
                        var optionMetadata1 = optionSet1.Options.FirstOrDefault(e => e.Value.HasValue && e.Value == optionMetadata2.Value);

                        if (optionMetadata1 != null)
                        {
                            continue;
                        }
                    }

                    List <string> listStrings = new List <string>();

                    CreateFileHandler.FillLabelDisplayNameAndDescription(listStrings, true, optionMetadata2.Label, optionMetadata2.Description, _tabSpacer);

                    optionValueOnly2.Add(Tuple.Create(optionMetadata2.Value.Value, optionMetadata2.IsManaged), listStrings);
                }

                foreach (var optionMetadata1 in optionSet1.Options.Where(e => e.Value.HasValue).OrderBy(e => e.Value))
                {
                    var optionMetadata2 = optionSet2.Options.FirstOrDefault(e => e.Value.HasValue && e.Value == optionMetadata1.Value);

                    if (optionMetadata2 == null)
                    {
                        continue;
                    }

                    List <string> optionDiff = await GetDifferenceOptionSetValue(optionMetadata1, optionMetadata2, entityName1, attributeName1, entityName2, attributeName2);

                    if (optionDiff.Count > 0)
                    {
                        optionValueDifferent.Add(optionMetadata1.Value.Value, optionDiff);
                    }
                }

                if (optionValueOnly1.Count > 0)
                {
                    if (strDifference.Count > 0)
                    {
                        strDifference.Add(string.Empty);
                    }

                    strDifference.Add(string.Format("Values ONLY EXISTS in {0}: {1}", _connectionName1, optionValueOnly1.Count));

                    foreach (var value in optionValueOnly1.OrderBy(s => s.Key.Item1))
                    {
                        strDifference.Add(_tabSpacer + string.Format("{0}   IsManaged: {1}", value.Key.Item1, value.Key.Item2));

                        foreach (var str in value.Value)
                        {
                            strDifference.Add(_tabSpacer + _tabSpacer + str);
                        }
                    }
                }

                if (optionValueOnly2.Count > 0)
                {
                    if (strDifference.Count > 0)
                    {
                        strDifference.Add(string.Empty);
                    }

                    strDifference.Add(string.Format("Values ONLY EXISTS in {0}: {1}", _connectionName2, optionValueOnly2.Count));

                    foreach (var value in optionValueOnly2)
                    {
                        strDifference.Add(_tabSpacer + string.Format("{0}   IsManaged: {1}", value.Key.Item1, value.Key.Item2));

                        foreach (var str in value.Value)
                        {
                            strDifference.Add(_tabSpacer + _tabSpacer + str);
                        }
                    }
                }

                if (optionValueDifferent.Count > 0)
                {
                    if (strDifference.Count > 0)
                    {
                        strDifference.Add(string.Empty);
                    }

                    strDifference.Add(string.Format("Values DIFFERENT in {0} and {1}: {2}", _connectionName1, _connectionName2, optionValueDifferent.Count));

                    foreach (var value in optionValueDifferent.OrderBy(e => e.Key))
                    {
                        strDifference.Add(_tabSpacer + value.Key);

                        foreach (var str in value.Value)
                        {
                            strDifference.Add(_tabSpacer + _tabSpacer + str);
                        }
                    }
                }
            }

            return(strDifference);
        }