log4net SDK Reference |

# DefaultRepositorySelector.CreateRepository Method (Assembly, Type)

Create a new repository for the assembly specified

[Visual Basic]
NotOverridable Overloads Public Function CreateRepository( _
ByVal repositoryAssembly As Assembly, _
ByVal repositoryType As Type _
) As ILoggerRepository _
Implements IRepositorySelector.CreateRepository
[C#]
public ILoggerRepository CreateRepository(
Assembly repositoryAssembly,
Type repositoryType
);

#### Parameters

repositoryAssembly
  the assembly to use to create the repository to associate with the ILoggerRepository.
repositoryType
  The type of repository to create, must implement ILoggerRepository.

#### Return Value

The repository created.

#### Implements

IRepositorySelector.CreateRepository

#### Remarks

The ILoggerRepository created will be associated with the repository specified such that a call to GetRepository 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.

#### Exceptions

Exception Type | Condition
--- | ---
ArgumentNullException | repositoryAssembly is a null reference (Nothing in Visual Basic).

#### See Also

DefaultRepositorySelector Class | log4net.Core Namespace | DefaultRepositorySelector.CreateRepository Overload List