public void NativeTypes_FiltersExpectedTypes()
        {
            var nativeTypes = new NativeTypesFeature();

            var result =
                Types.Concat(nativeTypes.MetadataTypesConfig.ExportTypes)
                    .Concat(new[] {typeof(Test5)})
                    .WithoutNativeTypes(nativeTypes);

            result.Should().BeEquivalentTo(Types);
        }
Example #2
0
 public CSharpGenerator(MetadataTypesConfig config)
 {
     Config = config;
     feature = HostContext.GetPlugin<NativeTypesFeature>();
 }
Example #3
0
 public SwiftGenerator(MetadataTypesConfig config)
 {
     Config = config;
     feature = HostContext.GetPlugin<NativeTypesFeature>();
     AllTypes = new List<MetadataType>();
 }
Example #4
0
 public TypeScriptGenerator(MetadataTypesConfig config)
 {
     Config  = config;
     feature = HostContext.GetPlugin <NativeTypesFeature>();
 }
 public SwiftGenerator(MetadataTypesConfig config)
 {
     Config   = config;
     feature  = HostContext.GetPlugin <NativeTypesFeature>();
     AllTypes = new List <MetadataType>();
 }
        /// <summary>
        /// Filters out ServiceStack native type namespaces and types
        /// </summary>
        /// <param name="types">the types to filter</param>
        /// <param name="nativeTypes">the NativeTypesFeature</param>
        /// <returns>the filtered types</returns>
        public static IEnumerable <Type> WithoutNativeTypes(this IEnumerable <Type> types, NativeTypesFeature nativeTypes)
        {
            return(nativeTypes == null

                ? types
                : types
                   .Where(x => !nativeTypes.MetadataTypesConfig.IgnoreTypes.Contains(x))
                   .Where(x => !nativeTypes.MetadataTypesConfig.IgnoreTypesInNamespaces.Contains(x.Namespace)));
        }
Example #7
0
 public GrpcProtoGenerator(MetadataTypesConfig config)
 {
     Config  = config;
     feature = HostContext.AssertPlugin <NativeTypesFeature>();
     grpc    = HostContext.AssertPlugin <GrpcFeature>();
 }