ShapeDiver.ContainerCastleWindsor
1.17.1
dotnet add package ShapeDiver.ContainerCastleWindsor --version 1.17.1
NuGet\Install-Package ShapeDiver.ContainerCastleWindsor -Version 1.17.1
<PackageReference Include="ShapeDiver.ContainerCastleWindsor" Version="1.17.1" />
paket add ShapeDiver.ContainerCastleWindsor --version 1.17.1
#r "nuget: ShapeDiver.ContainerCastleWindsor, 1.17.1"
// Install ShapeDiver.ContainerCastleWindsor as a Cake Addin #addin nuget:?package=ShapeDiver.ContainerCastleWindsor&version=1.17.1 // Install ShapeDiver.ContainerCastleWindsor as a Cake Tool #tool nuget:?package=ShapeDiver.ContainerCastleWindsor&version=1.17.1
ShapeDiver IOC Container using Castle Windsor
This package provides an implementation of ShapeDiver.ContainerInterfaces using the Castle Windsor Inversion of Control container.
This implementation is used by the ShapeDiver Plugin for Rhino and Grasshopper as well as other software packages provided by ShapeDiver.
How to get support
Examples
We provide examples on how to use the SDK on github and .NET Fiddle. Ask us on the Forum if you don’t understand how they work, or you want suggest further examples to be added.
Usage
using Castle.Windsor;
using Castle.Windsor.Installer;
using ShapeDiver.Common.Container;
// create a windsor container, install implementations from the ShapeDiver Castle Windsor assembly
var windsorContainer = new WindsorContainer();
windsorContainer.Install(FromAssembly.Named("SdContainerCastleWindsor"));
// resolve the implementation of the ShapeDiver IOC container wrapper for Castle Windsor
IIocContainer container = windsorContainer.Resolve<IIocContainer>();
container.SetContainer(windsorContainer);
// install from other assemblies that contain implementations you want to resolve
container.InstallFromAssembly("ShapeDiverSDK");
// register typed factories
container.RegisterTypedFactories();
// configure the container
container.Configure();
// late dependency resolution
container.ResolveLateDependencies();
Now you can resolve implementations, an example for the ShapeDiver SDK for .NET:
using ShapeDiver.SDK;
var sdk = container.Resolve<IShapeDiverSDK>();
Notes
Conventions
IIocContainer.InstallFromAssembly
uses the following convention for registering implementations:
Say you defined an interface called IMyService
, then InstallFromAssembly
will strip off the leading I
and look for matching implementations whose name
contain MyService
. In case the name of the implementation ends with Singleton
or Factory
it will be registered as a singleton. Otherwise
it will be registered using transient lifestyle, i.e. every call to Resolve
will create a new instance.
Typed factories
Typed factories are a very useful feature of Castle Windsor, read more about it here.
IIocContainer.RegisterTypedFactories
will try to register all interfaces whose name end with TypedFactory
as a typed factory.
Container configuration
In some cases you might want to automatically configure your container. If so, implement the IIocConfiguration
interface.
The call to IIocContainer.Configure
will resolve all implementations of IIocConfiguration
and call them. Typically you
want to call this before calling IIocContainer.ResolveLateDependencies
.
Late dependency resolving
Some of your implementations might want to resolve all implementations of an interface after installation of implementations
from all assemblies. In that case implement INeedsLateDependencyResolving
for your implementation.
The call to IIocContainer.ResolveLateDependencies
will resolve all implementations of INeedsLateDependencyResolving
and call them.
Typically you want to call this as the very last step before using the container.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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 was computed. |
.NET Framework | net461 is compatible. 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. |
-
.NETFramework 4.6.1
- Castle.Windsor (= 5.1.2)
- ShapeDiver.ContainerInterfaces (>= 1.17.1)
-
.NETStandard 2.0
- Castle.Windsor (= 5.1.2)
- ShapeDiver.ContainerInterfaces (>= 1.17.1)
- System.Drawing.Common (= 7.0.0)
- System.Resources.Extensions (= 7.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.17.1 | 114 | 4/5/2024 |
1.17.0 | 123 | 1/8/2024 |
1.17.0-beta | 141 | 11/30/2023 |
1.16.1 | 116 | 9/15/2023 |
1.16.0 | 149 | 6/26/2023 |
1.16.0-beta | 113 | 6/23/2023 |
1.15.0 | 154 | 5/24/2023 |
1.14.0 | 163 | 4/17/2023 |
1.11.6 | 364 | 10/17/2022 |
1.11.5 | 394 | 10/14/2022 |
1.11.4 | 372 | 10/13/2022 |
1.11.3 | 378 | 10/12/2022 |
1.11.2 | 364 | 10/6/2022 |
1.11.1 | 352 | 10/6/2022 |
1.11.0 | 380 | 9/28/2022 |
1.11.0-beta.4 | 115 | 9/8/2022 |
1.11.0-beta.3 | 100 | 9/7/2022 |
1.11.0-beta.2 | 94 | 9/7/2022 |
1.11.0-beta.1 | 93 | 9/7/2022 |
1.11.0-beta | 146 | 9/6/2022 |
1.10.0-beta | 144 | 8/10/2022 |