private StringBuilder GenerateInterface(GenerationElements elements)
        {
            var exitInterface = new StringBuilder();
            exitInterface.AppendFormat("\t {1} partial class {0} : {2}IBoDo", elements.GeneratedClassName, elements.ClassAccessModificator,
                string.IsNullOrEmpty(elements.SerializableBaseClassName) ? "" : elements.SerializableBaseClassName + ",");
            exitInterface.Append("\r\n");
            exitInterface.Append("\t {");
            exitInterface.Append("\r\n");
            foreach (var member in elements.Properties)
            {
                exitInterface.Append("\t\t public ");
                exitInterface.Append(member.Type.Trim() == "PosMoney" ? "decimal?" : member.Type);
                exitInterface.Append(" ");
                exitInterface.Append(member.Name);
                exitInterface.Append(" { get; set;}");
                exitInterface.Append("\r\n");
            }

            exitInterface.Append("\t }");
            exitInterface.Append("\r\n");

            return exitInterface;
        }
        private IEnumerable<GenerationElements> GetGenerationElements(IEnumerable<SourceElements> sourceElements)
        {
            var listGenEl = new List<GenerationElements>();
            SyntaxSerilizationHelper.InitVisitor(_projectNames);
            var namespaces = new List<string>();
            foreach (var sourceElem in sourceElements)
            {
                var textElements = new GenerationElements();
                var nameSpaceAndBaseClass = GetNamespace(sourceElem.CurrentClass);
                var propList = new List<GenerationProperty>();
                foreach (var property in sourceElem.Properties)
                {
                    propList.Add(new GenerationProperty
                    {
                        Name = EditingSerializationHelper.GetPropertyName(property.Identifier.Text),
                        Type = property.Type.ToFullString(),
                        VariableClassName = property.Identifier.Text,
                        IsSetterExist = property.SetterExist(),
                    });
                }

                foreach (var field in sourceElem.Fields)
                {
                    propList.Add(new GenerationProperty
                    {
                        Name = EditingSerializationHelper.GetPropertyName(field.Declaration.Variables.First().Identifier.ValueText),
                        Type = field.Declaration.Type.ToFullString(),
                        VariableClassName = field.Declaration.Variables.First().Identifier.ValueText,
                        IsSetterExist = true
                    });
                }

                textElements.IsPropertyEquals = false;

                if (sourceElem.MappingClass != null)
                {
                    var mapClassName = sourceElem.MappingClass.Identifier.Text;
                    var mappingProperies = new List<GenerationProperty>();
                    foreach (var property in sourceElem.MappingProperties)
                    {
                        var mapProperty = sourceElem.AllPublicProperties.FirstOrDefault(x => x.Identifier.Text.Trim() == property.Identifier.Text.Trim());
                        if (mapProperty == null)
                        {
                            continue;
                        }
                        mappingProperies.Add(new GenerationProperty
                        {
                            Name = EditingSerializationHelper.GetPropertyName(property.Identifier.Text),
                            Type = property.Type.ToFullString(),
                            VariableClassName = property.Identifier.Text,
                            IsSetterExist = property.SetterExist()
                        });
                    }
                    textElements.MapClassName = mapClassName;
                    textElements.MapProperties = mappingProperies;
                    textElements.IsPropertyEquals = TextSerializationHelper.IsCollectionEquals(mappingProperies, propList);
                    namespaces.Add(GetNamespace(sourceElem.MappingClass).Item1);
                }

                textElements.ClassName = sourceElem.CurrentClass.Identifier.Text;
                textElements.Properties = propList;
                textElements.GeneratedClassName = $"{sourceElem.CurrentClass.Identifier.Text}{_generationPrefix}";
                textElements.Namespace = nameSpaceAndBaseClass.Item1;
                textElements.UsingNamespaces = namespaces.Union(TextSerializationHelper.GetUsingNamespaces(sourceElem.CurrentClass));
                textElements.ClassAccessModificator = sourceElem.CurrentClass.Modifiers.FirstOrDefault().ValueText;
                textElements.SerializableBaseClassName = nameSpaceAndBaseClass.Item2;
                listGenEl.Add(textElements);
            }
            return listGenEl;
        }
 public TextSerializationPatterns(GenerationElements generationElements)
 {
     _generationElements = generationElements;
 }