CompactRepositorySelector CreateRepository Method (String, Type) | Apache log4net™ SDK Documentation

Create a new repository for the repository 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(
    	string repositoryName,
    	Type repositoryType
    )

    Public Function CreateRepository (
    	repositoryName As String,
    	repositoryType As Type
    ) As ILoggerRepository

    public:
    virtual ILoggerRepository^ CreateRepository(
    	String^ repositoryName,
    	Type^ repositoryType
    ) sealed

    abstract CreateRepository :
            repositoryName : string *
            repositoryType : Type -> ILoggerRepository
    override CreateRepository :
            repositoryName : string *
            repositoryType : Type -> ILoggerRepository

#### Parameters

repositoryName
  Type: System
  String
  the repository to associate with the ILoggerRepository
repositoryType
  Type: System
  Type
  the type of repository to create, must implement ILoggerRepository. If this param is null then the default repository type is used.

#### Return Value

Type: ILoggerRepository
the repository created

#### Implements

IRepositorySelector
CreateRepository(String, Type)
Exceptions

Exception | Condition
--- | ---
ArgumentNullException | throw if repositoryName is null
LogException | throw if the repositoryName already exists

Remarks

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

If the named repository already exists an exception will be thrown.

If repositoryType is null then the default repository type specified to the constructor is used.

See Also

#### Reference

CompactRepositorySelector Class
CreateRepository Overload
log4net.Core Namespace