5 changed files
WPE.App.Analytics | ||
ICurrentTabService.cs + | ||
NoOpCurrentTabService.cs + | ||
ServiceCollectionExtensions.cs | ||
WPE.App.Analytics.Native | ||
ServiceCollectionExtensions.cs | ||
version.props | ||
ICurrentTabService.cs
/WPE.App.Analytics/ICurrentTabService.cs/WPE.App.Analytics/ICurrentTabService.cs
NoOpCurrentTabService.cs
/WPE.App.Analytics/NoOpCurrentTabService.cs+12/WPE.App.Analytics/NoOpCurrentTabService.cs
Add comment 1 Plus namespace Infsoft.WPE.App.Analytics
Add comment 2 Plus {
Add comment 3 Plus /// <summary>
Add comment 4 Plus /// NoOp analytics implementation of <see cref="ICurrentTabService"/>
Add comment 5 Plus /// </summary>
Add comment 6 Plus public class NoOpCurrentTabService : ICurrentTabService
Add comment 7 Plus {
Add comment 8 Plus /// <inheritdoc/>
Add comment 9 Plus public string CurrentTab => string.Empty;
Add comment 10 Plus }
Add comment 11 Plus }
Add comment 12 Plus
ServiceCollectionExtensions.cs
/WPE.App.Analytics/ServiceCollectionExtensions.cs-4+6/WPE.App.Analytics/ServiceCollectionExtensions.cs
Add comment 8 public static class ServiceCollectionExtensions
Add comment 9 {
Add comment 10 /// <summary>
Add comment 11 Minus /// Add analytics service with <typeparamref name="T"/> as implementation
Add comment 11 Plus /// Add analytics service with <typeparamref name="TAnalytics"/> as implementation
Add comment 12 /// </summary>
Add comment 13 Minus /// <typeparam name="T">Implementation to use, if no analytics is used, configure with <see cref="NoOpAnalyticsService"/></typeparam>
Add comment 13 Plus /// <typeparam name="TAnalytics">Implementation to use, if no analytics is used, configure with <see cref="NoOpAnalyticsService"/></typeparam>
Add comment 14 Plus /// <typeparam name="TCurrentTab">Implementation to use, if no analytics is used, configure with <see cref="NoOpCurrentTabService"/></typeparam>
Add comment 14 15 /// <param name="services">ServiceCollection to add to</param>
Add comment 15 16 /// <returns>Service collection to chain calls</returns>
Add comment 16 Minus public static IServiceCollection AddAnalytics<T>(this IServiceCollection services) where T : class, IAnalyticsService
Add comment 17 Plus public static IServiceCollection AddAnalytics<TAnalytics, TCurrentTab>(this IServiceCollection services) where TAnalytics : class, IAnalyticsService where TCurrentTab : class, ICurrentTabService
Add comment 17 18 {
Add comment 18 19 services.AddSingleton<ISiteMetadataService, SiteMetadataService>();
Add comment 19 Minus return services.AddSingleton<IAnalyticsService, T>();
Add comment 20 Plus services.AddSingleton<ICurrentTabService, TCurrentTab>();
Add comment 21 Plus return services.AddSingleton<IAnalyticsService, TAnalytics>();
Add comment 20 22 }
Add comment 21 23 }
Add comment 22 24 }
ServiceCollectionExtensions.cs
/WPE.App.Analytics.Native/ServiceCollectionExtensions.cs/WPE.App.Analytics.Native/ServiceCollectionExtensions.cs