【发布时间】:2020-04-19 11:26:46
【问题描述】:
.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 只会调用
Type.Assembly来获取程序集。 -
这没什么特别的,它只是意味着您向 Automapper 表明您对包含这些类型的程序集感兴趣。您正在为 Automapper “标记”它们。
标签: c# .net types automapper .net-assembly