ShopifySharp.Extensions.DependencyInjection
1.4.0-b179
See the version list below for details.
dotnet add package ShopifySharp.Extensions.DependencyInjection --version 1.4.0-b179
NuGet\Install-Package ShopifySharp.Extensions.DependencyInjection -Version 1.4.0-b179
<PackageReference Include="ShopifySharp.Extensions.DependencyInjection" Version="1.4.0-b179" />
paket add ShopifySharp.Extensions.DependencyInjection --version 1.4.0-b179
#r "nuget: ShopifySharp.Extensions.DependencyInjection, 1.4.0-b179"
// Install ShopifySharp.Extensions.DependencyInjection as a Cake Addin #addin nuget:?package=ShopifySharp.Extensions.DependencyInjection&version=1.4.0-b179&prerelease // Install ShopifySharp.Extensions.DependencyInjection as a Cake Tool #tool nuget:?package=ShopifySharp.Extensions.DependencyInjection&version=1.4.0-b179&prerelease
ShopifySharp.Extensions.DependencyInjection
This package adds support for injecting ShopifySharp services into .NET classes using Microsoft's Dependency Injection framework. To do this, it exposes several methods that extend the IServiceCollection interface. Microsoft's DI framework will then make the ShopifySharp services available to the rest of your code when you add the interfaces to your class constructors.
// In your Program.cs or Startup.cs file, or wherever you register your Dependency Injection services
public class DependencyInjectionExample(IServiceCollection services)
{
// ...
// Add ShopifySharp's service factories and the LeakyBucketExecutionPolicy to your DI container
services.AddShopifySharp<LeakyBucketExecutionPolicy>(options =>
{
options.RequestExecutionPolicy = new LeakyBucketExecutionPolicy();
});
}
// In the class where you want to use a ShopifySharp service
public class MyClass(IOrderServiceFactory orderServiceFactory)
{
public async Task ListOrdersForUser()
{
var user = await DoSomethingToGetUser();
var credentials = new ShopifyRestApiCredentials(user.ShopDomain, user.AccessToken);
var orderService = orderServiceFactory.Create(credentials);
// Because the service was created using the injected factory class,
// it's automatically using the LeakyBucket request policy. That means it will
// gracefully handle Shopify's API request limit and will wait if it hits the
// limit (instead of throwing an exception).
var orders = await ordrService.ListAsync();
}
}
<a href="add-service-factories"></a>services.AddShopifySharpServiceFactories()
This extension method adds all of ShopifySharp's service factory classes to your IServiceCollection
. All factories will be added as singletons to the container. No request execution policy will be added via this method, but the factories will pick up any other request execution policy you add to your DI container. See services.AddShopifySharpRequestExecutionPolicy(IRequestExecutionPolicy)
to add one explicitly.
services.AddShopifySharpServiceFactories();
<a name="add-request-execution-policy"></a>services.AddShopifySharpRequestExecutionPolicy<T>()
where T: IRequestExecutionPolicy
This extension method adds the given IRequestExecutionPolicy
implementation class to your DI container as a singleton. Any ShopifySharp service factories that you add to your DI container, whether manually or via the other DI methods in this package, will use this policy.
services.AddShopifySharpRequestExecutionPolicy<LeakyBucketExecutionPolicy>();
<a href="add-shopifysharp"></a>services.AddShopifySharp<T>()
where T: IRequestExecutionPolicy
This is a convenience method and simply calls the other ShopifySharp DI extension methods sequentially to inject all ShopifySharp services into your DI container.
services.AddShopifySharp<LeakyBucketExecutionPolicy>();
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- microsoft.extensions.dependencyinjection (>= 8.0.0)
- ShopifySharp (>= 6.13.0-b179)
-
.NETStandard 2.1
- microsoft.extensions.dependencyinjection (>= 8.0.0)
- ShopifySharp (>= 6.13.0-b179)
-
net6.0
- microsoft.extensions.dependencyinjection (>= 8.0.0)
- ShopifySharp (>= 6.13.0-b179)
-
net7.0
- microsoft.extensions.dependencyinjection (>= 8.0.0)
- ShopifySharp (>= 6.13.0-b179)
-
net8.0
- microsoft.extensions.dependencyinjection (>= 8.0.0)
- ShopifySharp (>= 6.13.0-b179)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on ShopifySharp.Extensions.DependencyInjection:
Package | Downloads |
---|---|
Kentico.Xperience.Shopify
Xperience by Kentico - Shopify integration |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.7.0 | 3,026 | 10/1/2024 |
1.7.0-b214 | 52 | 10/21/2024 |
1.7.0-b213 | 58 | 10/4/2024 |
1.6.0 | 17,369 | 5/14/2024 |
1.6.0-b212 | 70 | 10/1/2024 |
1.6.0-b209 | 82 | 7/18/2024 |
1.6.0-b208 | 73 | 7/18/2024 |
1.6.0-b207 | 66 | 7/9/2024 |
1.6.0-b206 | 97 | 7/3/2024 |
1.6.0-b204 | 97 | 7/3/2024 |
1.6.0-b197 | 93 | 5/16/2024 |
1.5.0 | 41,355 | 4/2/2024 |
1.5.0-b195 | 92 | 5/14/2024 |
1.5.0-b193 | 79 | 5/14/2024 |
1.5.0-b192 | 92 | 5/10/2024 |
1.5.0-b191 | 107 | 5/8/2024 |
1.5.0-b190 | 94 | 4/30/2024 |
1.5.0-b189 | 90 | 4/17/2024 |
1.5.0-b188 | 90 | 4/11/2024 |
1.4.0 | 10,938 | 2/5/2024 |
1.4.0-b187 | 90 | 4/2/2024 |
1.4.0-b186 | 78 | 3/30/2024 |
1.4.0-b184 | 94 | 3/20/2024 |
1.4.0-b182 | 92 | 3/7/2024 |
1.4.0-b181 | 97 | 2/25/2024 |
1.4.0-b179 | 90 | 2/19/2024 |
1.4.0-b178 | 95 | 2/19/2024 |
1.4.0-b177 | 90 | 2/19/2024 |
1.4.0-b176 | 90 | 2/19/2024 |
1.4.0-b174 | 93 | 2/12/2024 |
1.4.0-b173 | 99 | 2/12/2024 |
1.3.0 | 1,703 | 1/5/2024 |
1.3.0-b172 | 87 | 2/5/2024 |
1.3.0-b171 | 85 | 2/5/2024 |
1.3.0-b170 | 87 | 1/30/2024 |
1.3.0-b169 | 82 | 1/29/2024 |
1.3.0-b168 | 92 | 1/29/2024 |
1.3.0-b166 | 92 | 1/19/2024 |
1.3.0-b165 | 87 | 1/18/2024 |
1.2.0 | 5,660 | 12/19/2023 |
1.2.0-b160 | 95 | 1/5/2024 |
1.1.1 | 177 | 12/18/2023 |
1.1.1-b158 | 88 | 12/19/2023 |
1.1.1-b156 | 112 | 12/19/2023 |
1.1.0 | 147 | 12/17/2023 |
1.1.0-b155 | 121 | 12/18/2023 |
1.1.0-b154 | 116 | 12/18/2023 |
1.1.0-b153 | 99 | 12/18/2023 |
1.0.0 | 1,043 | 12/11/2023 |
1.0.0-b151 | 133 | 12/17/2023 |
1.0.0-b150 | 122 | 12/17/2023 |
1.0.0-b149 | 110 | 12/16/2023 |
1.0.0-b146 | 125 | 12/14/2023 |
1.0.0-b145 | 122 | 12/14/2023 |
1.0.0-b144 | 117 | 12/13/2023 |
1.0.0-b143 | 126 | 12/11/2023 |
1.0.0-b142 | 110 | 12/9/2023 |
1.0.0-b141 | 97 | 12/9/2023 |
1.0.0-b139 | 124 | 12/9/2023 |
1.0.0-b138 | 105 | 12/8/2023 |