/// <summary>
        /// Registers ApplicationInsightsTracer
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static IDotvvmOptions AddApplicationInsightsTracing(this IDotvvmOptions options)
        {
            options.AddApplicationInsightsTracingInternal();
            options.Services.AddTransient <IConfigureOptions <DotvvmConfiguration>, ApplicationInsightSetup>();

            return(options);
        }
Esempio n. 2
0
        /// <summary>
        /// Registers MiniProfiler tracer and MiniProfilerWidget
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static IDotvvmOptions AddMiniProfilerEventTracing(this IDotvvmOptions options)
        {
            options.Services.AddTransient <IRequestTracer, MiniProfilerTracer>();
            options.Services.AddTransient <IConfigureOptions <DotvvmConfiguration>, MiniProfilerSetup>();

            return(options);
        }
Esempio n. 3
0
 /// <summary>
 /// Adds file system returned file storage to the application. See <see cref="IReturnedFileStorage" /> for more details.
 /// </summary>
 /// <param name="options">The <see cref="IDotvvmOptions" /> instance.</param>
 /// <param name="tempPath">The absolute or relative path to directory where to store temporary files.</param>
 /// <param name="autoDeleteInterval">The interval to delete the temporary files after.</param>
 public static IDotvvmOptions AddReturnedFileStorage(this IDotvvmOptions options, string tempPath, TimeSpan autoDeleteInterval)
 {
     options.Services.TryAddSingleton <IReturnedFileStorage>(s =>
     {
         var fullPath = Path.Combine(s.GetService <DotvvmConfiguration>().ApplicationPhysicalPath, tempPath);
         return(new FileSystemReturnedFileStorage(fullPath, autoDeleteInterval));
     });
     return(options);
 }
Esempio n. 4
0
        /// <summary>
        /// Registers ApplicationInsightsTracer
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        internal static IDotvvmOptions AddApplicationInsightsTracingInternal(this IDotvvmOptions options)
        {
            var builder = TelemetryConfiguration.Active.TelemetryProcessorChainBuilder;

            builder.Use((next) => new RequestTelemetryFilter(next));
            builder.Build();

            options.Services.TryAddSingleton <TelemetryClient>();
            options.Services.AddTransient <IRequestTracer, ApplicationInsightsTracer>();

            return(options);
        }
        /// <summary>
        /// Registers MiniProfiler tracer and MiniProfilerWidget
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public static IDotvvmOptions AddMiniProfilerEventTracing(this IDotvvmOptions options)
        {
            options.Services.AddTransient <IRequestTracer, MiniProfilerTracer>();

            options.Services.Configure((MiniProfilerOptions opt) =>
            {
                opt.IgnoredPaths.Add("/dotvvmResource/");
            });

            options.Services.Configure((DotvvmConfiguration conf) =>
            {
                conf.Markup.AddCodeControls("dot", typeof(MiniProfilerWidget));
                conf.Runtime.GlobalFilters.Add(
                    new MiniProfilerActionFilter(conf.ServiceLocator.GetService <IOptions <MiniProfilerOptions> >()));
            });

            return(options);
        }
Esempio n. 6
0
 /// <summary>
 /// Adds file system returned file storage to the application. See <see cref="IReturnedFileStorage" /> for more details.
 /// </summary>
 /// <param name="options">The <see cref="IDotvvmOptions" /> instance.</param>
 /// <param name="tempPath">The absolute or relative path to directory where to store temporary files.</param>
 public static IDotvvmOptions AddReturnedFileStorage(this IDotvvmOptions options, string tempPath)
 => options.AddReturnedFileStorage(tempPath, TimeSpan.FromMinutes(30));
Esempio n. 7
0
 /// <summary>
 /// Adds file system temporary file storages to the application. See <see cref="IUploadedFileStorage" />
 /// and <see cref="IReturnedFileStorage" /> for more details.
 /// </summary>
 /// <param name="options">The <see cref="IDotvvmOptions" /> instance.</param>
 /// <param name="tempPath">The absolute or relative path to directory where to store temporary files.</param>
 /// <param name="autoDeleteInterval">The interval to delete the temporary files after.</param>
 public static IDotvvmOptions AddDefaultTempStorages(this IDotvvmOptions options, string tempPath, TimeSpan autoDeleteInterval)
 {
     return(options
            .AddUploadedFileStorage(Path.Combine(tempPath, "uploadedFiles"), autoDeleteInterval)
            .AddReturnedFileStorage(Path.Combine(tempPath, "returnedFiles"), autoDeleteInterval));
 }
Esempio n. 8
0
 /// <summary>
 /// Adds file system temporary file storages to the application. See <see cref="IUploadedFileStorage" />
 /// and <see cref="IReturnedFileStorage" /> for more details.
 /// </summary>
 /// <param name="options">The <see cref="IDotvvmOptions" /> instance.</param>
 /// <param name="tempPath">The absolute or relative path to directory where to store temporary files.</param>
 public static IDotvvmOptions AddDefaultTempStorages(this IDotvvmOptions options, string tempPath)
 => options.AddDefaultTempStorages(tempPath, TimeSpan.FromMinutes(30));
Esempio n. 9
0
 /// <summary>
 /// Registers TelemetryClient and ApplicationInsightsReporter
 /// </summary>
 /// <param name="options"></param>
 /// <returns></returns>
 public static IDotvvmOptions AddApplicationInsightsTracing(this IDotvvmOptions options)
 {
     options.Services.TryAddSingleton <TelemetryClient>();
     options.Services.TryAddSingleton <IRequestTracingReporter, ApplicationInsightsReporter>();
     return(options);
 }