DefaultRepositorySelector CreateRepository Method (Assembly, Type, String, Boolean) | Apache log4net™ SDK Documentation

Creates a new repository for the assembly specified.

Namespace: log4net.Core
Assembly: log4net (in log4net.dll) Version: 2.0.8.0-.NET 4.0
Syntax

C#
VB
C++
F#
Copy

    public ILoggerRepository CreateRepository(
    	Assembly repositoryAssembly,
    	Type repositoryType,
    	string repositoryName,
    	bool readAssemblyAttributes
    )

    Public Function CreateRepository (
    	repositoryAssembly As Assembly,
    	repositoryType As Type,
    	repositoryName As String,
    	readAssemblyAttributes As Boolean
    ) As ILoggerRepository

    public:
    ILoggerRepository^ CreateRepository(
    	Assembly^ repositoryAssembly,
    	Type^ repositoryType,
    	String^ repositoryName,
    	bool readAssemblyAttributes
    )

    member CreateRepository :
            repositoryAssembly : Assembly *
            repositoryType : Type *
            repositoryName : string *
            readAssemblyAttributes : bool -> ILoggerRepository

#### Parameters

repositoryAssembly
  Type: System.Reflection
  Assembly
  the assembly to use to create the repository to associate with the ILoggerRepository.
repositoryType
  Type: System
  Type
  The type of repository to create, must implement ILoggerRepository.
repositoryName
  Type: System
  String
  The name to assign to the created repository
readAssemblyAttributes
  Type: System
  Boolean
  Set to true to read and apply the assembly attributes

#### Return Value

Type: ILoggerRepository
The repository created.
Exceptions

Exception | Condition
--- | ---
ArgumentNullException | repositoryAssembly is .

Remarks

The ILoggerRepository created will be associated with the repository specified such that a call to [M:GetRepository(Assembly)] with the same assembly specified will return the same repository instance.

The type of the ILoggerRepository created and the repository to create can be overridden by specifying the RepositoryAttribute attribute on the repositoryAssembly. The default values are to use the repositoryType implementation of the ILoggerRepository interface and to use the Name as the name of the repository.

The ILoggerRepository created will be automatically configured using any ConfiguratorAttribute attributes defined on the repositoryAssembly.

If a repository for the repositoryAssembly already exists that repository will be returned. An error will not be raised and that repository may be of a different type to that specified in repositoryType. Also the RepositoryAttribute attribute on the assembly may be used to override the repository type specified in repositoryType.

See Also

#### Reference

DefaultRepositorySelector Class
CreateRepository Overload
log4net.Core Namespace