Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

IResource Interface

The central abstraction for Spring.NET's access to resources such as Streams.

For a list of all members of this type, see IResource Members .

[Visual Basic]
<TypeConverter(ConverterTypeName:="Spring.Core.IO.ResourceConverter, Spring.Core, Version=, Culture=neutral, PublicKeyToken=65e474d141e25e07")> _
Public Interface IResource
    Implements IInputStreamSource
[TypeConverter(ConverterTypeName="Spring.Core.IO.ResourceConverter, Spring.Core, Version=, Culture=neutral, PublicKeyToken=65e474d141e25e07")]
public interface IResource : IInputStreamSource

Types that implement IResource

Type Description
AbstractResource Convenience base class for IResource implementations, pre-implementing typical behavior.
AssemblyResource An IResource implementation for resources stored within assemblies.
ConfigSectionResource Used when retrieving information from the standard .NET configuration files (App.config / Web.config).
FileSystemResource A File backed resource.
InputStreamResource IResource adapter implementation for a Stream.
StringResource A IResource adapter implementation encapsulating a simple string.
UrlResource A Uri backed resource on top of WebRequest
WebResource IResource implementation specifically for resources served up from a web server.


This interface encapsulates a resource descriptor that abstracts away from the underlying type of resource; possible resource types include files, memory streams, and databases (this list is not exhaustive).

A Stream can definitely be opened and accessed for every such resource; if the resource exists in a physical form (for example, the resource is not an in-memory stream or one that has been extracted from an assembly or ZIP file), a Uri or FileInfo can also be accessed. The actual behavior is implementation-specific.

This interface, when used in tandem with the IResourceLoader interface, forms the backbone of Spring.NET's resource handling. Third party extensions or libraries that want to integrate external resources with Spring.NET's IoC container are encouraged expose such resources via this abstraction.

Interfaces cannot obviously mandate implementation, but derived classes are strongly encouraged to expose a constructor that takes a single String as it's sole argument (see example). Exposing such a constructor will make your custom IResource implementation integrate nicely with the ConfigurableResourceLoader class.


Namespace: Spring.Core.IO

Assembly: Spring.Core (in Spring.Core.dll)

See Also

IResource Members | Spring.Core.IO Namespace | IResourceLoader | ConfigurableResourceLoader