Collections

Grace supports importing sets of exports into multiple different container types. Below a list of supported imports and what type is used to satisfy them
  • IEnumerable<T> - implemented with List<T>
  • ICollection<T> - implemented with List<T>
  • IList<T> - implemented with List<T>
  • List<T> - implemented with List<T>
  • IReadOnlyCollection<T> - implemented with ReadOnlyCollection<T>
  • IReadOnlyList<T> - implemented with ReadOnlyCollection<T>
  • ReadOnlyCollection<T> - implemented with ReadOnlyCollection<T>
  • T[] - implemented with an array
  • ObservableCollection<T> - any concrete class that implements ICollection<T> can be imported, including ObservableCollection<T>

Func<T>

When you import a Func<T> a new function will be created that calls the current scope to locate an instance. If you import a function that takes input parameters, the parameters will be used during the resolution process.

Func<Type,object>

When you import Func<Type,object> a new function will be created that calls the current scope Locate(Type) method. This can alleviate the need to import the IInjectionScope.

Lazy<T>

The container supports importing Lazy<T>, where the value function will look up T from the current scope.

Owned<T>

When importing an Owned<T> the disposal scope for all children of Owned<T> will use the Owned<T> for their disposal scope.

Primitive, DateTime, DateTimeOffSet, TimeSpan, string

When resolving these types it's done by name rather than by type. The reasoning behind this is that resolving types like int aren't the same between classes. The parameter or property name provides far more information on how to resolve it than the type does.

Last edited Nov 30, 2013 at 4:20 PM by ipjohnson123, version 9