簡體   English   中英

.NET 中程序集的標記類型是什么?

[英]What are the marker types for assemblies in .NET?

.NET 中程序集的標記類型是什么?

我通過教程學習AutoMapper,我碰到的概念marker types for assemblies這里

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

在尋找我的問題的答案時,我遇到了這個問題。 但我無法在那里找到答案。

我猜,這在AutoMapper和您的示例的范圍內

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

它意味着來自特定程序集的任何類型,用於“標記”程序集以掃描映射配置文件。 將掃描包含HomeControllerEntity類型的程序集,以獲取從Profile繼承的類型以進行映射器配置

AutoMapper 將掃描從 Profile 繼承的類的指定程序集並將它們添加到配置中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM