Ejemplo n.º 1
0
            public EntityGenerator(
                    Language language,
                    SyntaxGenerator syntaxGenerator,
                    Solution solution,
                    Compilation compilation,
                    IImmutableList<INamedTypeSymbol> interfaceSymbols,
                    Func<INamedTypeSymbol, string> entityNamespaceSelector,
                    Func<INamedTypeSymbol, string> entityNameSelector,
                    Func<INamedTypeSymbol, Accessibility> entityAccessibilitySelector,
                    INamedTypeSymbol interfaceSymbol)
                : base(language, syntaxGenerator, solution, compilation, entityNamespaceSelector(interfaceSymbol), interfaceSymbols, entityNamespaceSelector, entityNameSelector)
            {
                this.interfaceSymbol = interfaceSymbol;
                this.name = entityNameSelector(interfaceSymbol);
                this.accessibility = entityAccessibilitySelector(interfaceSymbol);

                var basicTypes = new[]
                {
                    typeof(bool).FullName,
                    typeof(short).FullName,
                    typeof(int).FullName,
                    typeof(long).FullName,
                    typeof(ushort).FullName,
                    typeof(uint).FullName,
                    typeof(ulong).FullName,
                    typeof(string).FullName,
                    typeof(decimal).FullName,
                    typeof(double).FullName,
                    typeof(float).FullName,
                    typeof(byte).FullName,
                    typeof(char).FullName,
                    typeof(sbyte).FullName,
                    typeof(DateTime).FullName,
                    typeof(Guid).FullName,
                    typeof(Uri).FullName,
                    Constants.PlainLiteral,
                };

                this.basicTypes = new HashSet<ITypeSymbol>(basicTypes.Select(x => compilation.GetTypeByMetadataName(x)));
            }