AzureTableServiceCollectionExtensions.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using TEAMModelOS.SDK.Module.AzureTable.Implements;
  2. using TEAMModelOS.SDK.Module.AzureTable.Interfaces;
  3. using Microsoft.Extensions.DependencyInjection;
  4. using System;
  5. namespace TEAMModelOS.SDK.Module.AzureTable.Configuration
  6. {
  7. public static class AzureTableServiceCollectionExtensions
  8. {
  9. public static AzureTableServiceBuilder Builder { get; set; }
  10. /// <summary>
  11. ///
  12. /// </summary>
  13. /// <param name="services"></param>
  14. /// <returns></returns>
  15. private static AzureTableServiceBuilder AddServerBuilder(this IServiceCollection services)
  16. {
  17. return new AzureTableServiceBuilder(services);
  18. }
  19. /// <summary>
  20. ///
  21. /// </summary>
  22. /// <param name="services"></param>
  23. /// <returns></returns>
  24. public static AzureTableServiceBuilder AddAzureTableStorage(this IServiceCollection services)
  25. {
  26. if (Builder == null)
  27. {
  28. Builder = services.AddServerBuilder();
  29. }
  30. //services.AddSingleton<IAzureTableDBRepository, AzureTableDBRepository>();
  31. return Builder;
  32. }
  33. /// <summary>
  34. ///
  35. /// </summary>
  36. /// <param name="builder"></param>
  37. /// <param name="_connectionString"></param>
  38. /// <returns></returns>
  39. public static AzureTableServiceBuilder AddConnection(this AzureTableServiceBuilder builder, AzureTableOptions databaseOptions)
  40. {
  41. //builder.Services.AddSingleton(databaseOptions);
  42. return builder;
  43. }
  44. }
  45. }