Пример #1
0
        public object Any(TypesDart request)
        {
            request.BaseUrl = GetBaseUrl(request.BaseUrl);

            var typesConfig = NativeTypesMetadata.GetConfig(request);

            typesConfig.ExportAsTypes = true;

            var metadataTypes = ConfigureScript(typesConfig);

            if (!DartGenerator.GenerateServiceStackTypes)
            {
                var ignoreDartLibraryTypes = ReturnInterfaces.Map(x => x.Name);
                ignoreDartLibraryTypes.AddRange(BuiltinInterfaces.Select(x => x.Name));
                ignoreDartLibraryTypes.AddRange(BuiltInClientDtos.Select(x => x.Name));

                metadataTypes.Operations.RemoveAll(x => ignoreDartLibraryTypes.Contains(x.Request.Name));
                metadataTypes.Operations.Each(x => {
                    if (x.Response != null && ignoreDartLibraryTypes.Contains(x.Response.Name))
                    {
                        x.Response = null;
                    }
                });
                metadataTypes.Types.RemoveAll(x => ignoreDartLibraryTypes.Contains(x.Name));
            }

            var generator = ((NativeTypesMetadata)NativeTypesMetadata).GetMetadataTypesGenerator(typesConfig);

            var dart = new DartGenerator(typesConfig).GetCode(metadataTypes, base.Request, NativeTypesMetadata);

            return(dart);
        }
Пример #2
0
        public object Any(TypesDart request)
        {
            if (request.BaseUrl == null)
            {
                request.BaseUrl = Request.GetBaseUrl();
            }

            var typesConfig = NativeTypesMetadata.GetConfig(request);

            typesConfig.ExportAsTypes = true;

            var ignoreDartLibraryTypes = ReturnInterfaces.Map(x => x.Name);

            ignoreDartLibraryTypes.AddRange(BuiltinInterfaces.Select(x => x.Name));
            ignoreDartLibraryTypes.AddRange(new[] {
                typeof(QueryBase).Name,
                typeof(QueryData <>).Name,
                typeof(QueryDb <>).Name,
                typeof(QueryDb <,>).Name,
            });

            var metadataTypes = ConfigureScript(typesConfig);

            metadataTypes.Types.RemoveAll(x => ignoreDartLibraryTypes.Contains(x.Name));

            var dart = new DartGenerator(typesConfig).GetCode(metadataTypes, base.Request, NativeTypesMetadata);

            return(dart);
        }