.NET 中程序集的标记类型是什么?

What are the marker types for assemblies in .NET?

.NET 中程序集的标记类型是什么?

我正在通过教程学习 AutoMapper,我在 here 上遇到了 marker types for assemblies 的概念:

// Or marker types for assemblies:
var configuration = new MapperConfiguration(cfg =>
    cfg.AddMaps(new [] {
        typeof(HomeController),
        typeof(Entity)
    });
);

在寻找我的问题的答案时,我提出了 this SO 问题。但是我在那里找不到答案。

我想,在 AutoMapper 和您的示例范围内

// Or marker types for assemblies:
var configuration = new MapperConfiguration(cfg =>
    cfg.AddMaps(new [] {
        typeof(HomeController),
        typeof(Entity)
    });
);

它表示来自特定程序集的任何类型,用于"mark" 程序集扫描映射配置文件。将扫描包含 HomeControllerEntity 类型的程序集以获取从 Profile 继承的类型以用于映射器配置

AutoMapper will scan the designated assemblies for classes inheriting from Profile and add them to the configuration