public TypeHelper(TypeScriptGeneratorOptions options)
 {
     Options        = options;
     doneTypes      = new HashSet <Type>();
     InterfaceTypes = new Queue <Type>();
     EnumTypes      = new HashSet <Type>();
 }
Пример #2
0
        public HubHelper(TypeScriptGeneratorOptions options)
        {
            typeHelper = new TypeHelper(options);

            var defaultDependencyResolver = new DefaultDependencyResolver();

            hubmanager = new DefaultHubManager(defaultDependencyResolver);
        }
Пример #3
0
        public static void Main(string[] args)
        {
            #if !RELEASE
            TypeScriptGeneratorOptions generatorOptions =
                new TypeScriptGeneratorOptions {
                EmitIinInterface = false,
                IgnoreNamespaces = true
            };

            TypeScriptGenerator generator =
                new TypeScriptGenerator(generatorOptions)
                .ExcludeType(typeof(Program))
                .AddCSType(typeof(TimeSeries))
                .AddCSType(typeof(TimeSeriesDataGroup))
                .AddCSType(typeof(DemographicData))
                .AddCSType(typeof(DemographicDataItem))
                .AddCSType(typeof(MetricInfo))
                .AddCSType(typeof(Metric))
                .AddCSType(typeof(PersonaMetric))
                .AddCSType(typeof(Tag))
                .AddCSType(typeof(Source))
                .AddCSType(typeof(VideoMetric))
                .AddCSType(typeof(Video))
                .AddCSType(typeof(ExternalLoginViewModel))
                .AddCSType(typeof(EditType))
                .AddCSType(typeof(AddOrRemove))
                .AddCSType(typeof(VideoEdit))
                .AddCSType(typeof(TagEdit))
                .AddCSType(typeof(TagEdits))
                .AddCSType(typeof(VideoEdits))
                .AddCSType(typeof(ArchiveMode))
                .AddCSType(typeof(PersonaVersion))
                .AddCSType(typeof(PersonaVersionEdit))
                .AddCSType(typeof(PersonaVersionEdits))
                .AddCSType(typeof(AccountEdit))
                .AddCSType(typeof(SingleAccountEdit))
                .AddCSType(typeof(AccountInfo))
                .AddCSType(typeof(AllAccountsInfo))
                .AddCSType(typeof(TimeSeriesChartData))
                .AddCSType(typeof(ChartObject))
                .AddCSType(typeof(AuthStateInfo));

            // TypeScriptBuilder does not seem to support adding "| null" to some type, but this is needed for
            // VideoEdit.cs, for the MetaTags attribute, so doing it manually here
            var types = generator.ToString()
                        .Replace(
                "metaTags?: { [index: string]: string }",
                "metaTags?: { [index: string]: string | null }"
                );
            File.WriteAllText("ClientApp/types.ts", types);
            // Putting this initialization logic here prevents Initialize to run on dotnet ef commands
            #endif
            var webHost = BuildWebHost(args);
            #if !NOAUTH
            using (var scope = webHost.Services.CreateScope()) {
                var services = scope.ServiceProvider;
                services.GetService <IDbInitializer>().Initialize();
            }
            #endif
            webHost.Run();
        }