Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with bodyInner Builder.Append
Contact bodyInner Builder.Append, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck RackActions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Articles
使用Roslyn的源生成器生成DTO - 万雅虎 - 博客园
前言 源生成器的好处很多, 通过在编译时生成代码,可以减少运行时的反射和动态代码生成,从而提高应用程序的性能, 有时候需要对程序AOT以及裁剪编译的dll也是需要用SG来处理的。 我们开发程序应该都绕不过Mapper对象映射,用的比较多的库可能就是AutoMapper,Maspter之内的三方库吧;这些库很强大但是因为内部实现存在反射,因此开发的程序就没办法AOT了,因此如果程序不是很复杂但是又有很特殊的需求,建议使用SG来实现Mapper 功能演示 这里我演示下自己开发的AutoDto生成DTO功能: 比如我们有一个User的类,需要生成UserDto public class User { public string Id { get; set; } = null!; public string FirstName { get; set; } = null!; public string LastName { get; set; } = null!; public int? Age { get; set; } public string?
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with bodyInner Builder.Append
Contact bodyInner Builder.Append, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack