public static IEnumerable <string> CreateTypeImports(Type type)
        {
            type.CheckArgument(nameof(type));

            var result     = new List <string>();
            var properties = ContractHelper.GetAllProperties(type);
            var entityName = CreateEntityNameFromInterface(type);

            foreach (var propertyInfo in properties)
            {
                if (propertyInfo.PropertyType.IsEnum)
                {
                    var typeName = $"{propertyInfo.PropertyType.Name}";

                    if (typeName.Equals(entityName) == false)
                    {
                        var subPath = GeneratorObject.CreateSubPathFromType(propertyInfo.PropertyType).ToLower();

                        result.Add(CreateImport(typeName, subPath));
                    }
                }
                else if (propertyInfo.PropertyType.IsGenericType)
                {
                    Type subType = propertyInfo.PropertyType.GetGenericArguments().First();

                    if (subType.IsInterface)
                    {
                        var typeName = subType.Name[1..];
        /// <summary>
        /// Diese Methode erstellt den Programmcode einer Eigenschaft aus dem Eigenschaftsinfo-Objekt.
        /// </summary>
        /// <param name="propertyInfo">Das Eigenschaftsinfo-Objekt.</param>
        /// <returns>Die Eigenschaft als Text.</returns>
        internal static IEnumerable <string> CreatePartialDelegateProperty(PropertyInfo propertyInfo)
        {
            propertyInfo.CheckArgument(nameof(propertyInfo));

            var result    = new List <string>();
            var propName  = propertyInfo.Name;
            var fieldType = GeneratorObject.GetPropertyType(propertyInfo);

            result.Add($"public {fieldType} {propName}");
            result.Add("{");
            if (propertyInfo.CanRead)
            {
                result.AddRange(CreatePartialGetDelegateProperty(propertyInfo));
            }
            if (propertyInfo.CanWrite)
            {
                result.AddRange(CreatePartialSetDelegateProperty(propertyInfo));
            }
            result.Add("}");

            if (propertyInfo.CanRead)
            {
                result.Add($"partial void On{propName}Reading();");
            }
            if (propertyInfo.CanWrite)
            {
                result.Add($"partial void On{propName}Changed();");
            }
            return(result);
        }
        public string CreateModelsNamespace(Type type)
        {
            type.CheckArgument(nameof(type));

            return($"{AppModelsNameSpace}.{GeneratorObject.CreateSubNamespaceFromType(type)}");
        }
        public string CreateLogicControllerNameSpace(Type type)
        {
            type.CheckArgument(nameof(type));

            return($"{LogicControllerNameSpace}.{GeneratorObject.CreateSubNamespaceFromType(type)}");
        }
        /// <summary>
        /// Diese Methode erstellt den Programmcode der Beziehungen zwischen den Entitaeten aus den Schnittstellen-Typen.
        /// </summary>
        /// <param name="type">Der Schnittstellen-Typ.</param>
        /// <param name="types">Die Schnittstellen-Typen.</param>
        /// <param name="mapPropertyName">Ein Lambda-Ausdruck zum konvertieren des Eigenschaftsnamen.</param>
        /// <returns>Die Entitaet als Text.</returns>
        private Contracts.IGeneratedItem CreateEntityToEntityFromContracts(Type type, IEnumerable <Type> types)
        {
            type.CheckArgument(nameof(type));
            types.CheckArgument(nameof(types));

            var typeName = CreateEntityNameFromInterface(type);
            var result   = new Models.GeneratedItem(Common.UnitType.Logic, Common.ItemType.PersistenceEntity)
            {
                FullName      = CreateEntityFullNameFromInterface(type),
                FileExtension = StaticLiterals.CSharpFileExtension,
            };

            result.SubFilePath = $"{result.FullName}PartB{result.FileExtension}";
            result.Add($"partial class {typeName}");
            result.Add("{");

            foreach (var other in types)
            {
                var otherHelper = new ContractHelper(other);

                if (otherHelper.ContextType != CommonBase.Attributes.ContextType.View)
                {
                    var otherName = GeneratorObject.CreateEntityNameFromInterface(other);

                    foreach (var pi in other.GetProperties())
                    {
                        if (pi.Name.Equals($"{typeName}Id"))
                        {
                            var otherFullName  = GeneratorObject.CreateEntityFullNameFromInterface(other);
                            var navigationName = $"{otherName}s";

                            result.Add(($"public System.Collections.Generic.ICollection<{otherFullName}> {navigationName} " + "{ get; set; }"));
                        }
                    }
                }
            }

            var interfaces    = new List <Type>();
            var typeInterface = GetTypeInterface(type);

            interfaces.Add(type);
            foreach (var item in GeneratorObject.GetInterfaces(type)
                     .Where(t => t != typeInterface))
            {
                interfaces.Add(item);
            }

            foreach (var item in interfaces)
            {
                foreach (var pi in item.GetProperties())
                {
                    foreach (var other in types)
                    {
                        var otherHelper = new ContractHelper(other);

                        if (otherHelper.ContextType != CommonBase.Attributes.ContextType.View)
                        {
                            var otherName = GeneratorObject.CreateEntityNameFromInterface(other);

                            if (pi.Name.Equals($"{otherName}Id"))
                            {
                                var propHelper     = new ContractPropertyHelper(pi);
                                var otherFullName  = GeneratorObject.CreateEntityFullNameFromInterface(other);
                                var navigationName = propHelper.NavigationName.GetValueOrDefault(otherName);

                                result.Add(($"[System.ComponentModel.DataAnnotations.Schema.ForeignKey(\"{pi.Name}\")]"));
                                result.Add(($"public {otherFullName} {navigationName} " + "{ get; set; }"));
                            }
                            else if (pi.Name.StartsWith($"{otherName}Id_"))
                            {
                                var data = pi.Name.Split("_");

                                if (data.Length == 2)
                                {
                                    var otherFullName = GeneratorObject.CreateEntityFullNameFromInterface(other);

                                    result.Add(($"[System.ComponentModel.DataAnnotations.Schema.ForeignKey(\"{pi.Name}\")]"));
                                    result.Add(($"public {otherFullName} {data[1]} " + "{ get; set; }"));
                                }
                            }
                        }
                    }
                }
            }
            result.Add("}");
            result.EnvelopeWithANamespace(CreateNameSpace(type));
            result.FormatCSharpCode();
            return(result);
        }