Table of Contents

Class RepositoryAttribute

Namespace
log4net.Config
Assembly
log4net.dll

Assembly level attribute that specifies the logging repository for the assembly.

[AttributeUsage(AttributeTargets.Assembly)]
public class RepositoryAttribute : Attribute
Inheritance
RepositoryAttribute
Derived
Inherited Members

Remarks

Assemblies are mapped to logging repository. This attribute specified on the assembly controls the configuration of the repository. The Name property specifies the name of the repository that this assembly is a part of. The RepositoryType specifies the type of the ILoggerRepository object to create for the assembly. If this attribute is not specified or a Name is not specified then the assembly will be part of the default shared logging repository.

This attribute can only be specified on the assembly and may only be used once per assembly.

Constructors

RepositoryAttribute()

Initializes a new instance of the RepositoryAttribute class.

public RepositoryAttribute()

Remarks

Default constructor.

RepositoryAttribute(string)

Initialize a new instance of the RepositoryAttribute class with the name of the repository.

public RepositoryAttribute(string name)

Parameters

name string

The name of the repository.

Remarks

Initialize the attribute with the name for the assembly's repository.

Properties

Name

Gets or sets the name of the logging repository.

public string Name { get; set; }

Property Value

string

The string name to use as the name of the repository associated with this assembly.

Remarks

This value does not have to be unique. Several assemblies can share the same repository. They will share the logging configuration of the repository.

RepositoryType

Gets or sets the type of repository to create for this assembly.

public Type RepositoryType { get; set; }

Property Value

Type

The type of repository to create for this assembly.

Remarks

The type of the repository to create for the assembly. The type must implement the ILoggerRepository interface.

This will be the type of repository created when the repository is created. If multiple assemblies reference the same repository then the repository is only created once using the RepositoryType of the first assembly to call into the repository.