您的私人编码助手
MappingGenerator 最初是作为 AutoMapper 的设计时替代品创建的。现在它正在演变为编码助手,您可以将最平凡的编码任务委派给它:
- 生成映射
- 生成显式转换
- 实施克隆
- 生成投影表达式
- 脚手架方法调用
- 脚手架对象创建
- 清理方法调用
- 方便ILogger的使用
成为高效的开发人员
少打字,专注于重要的事情!
调用脚手架
您是否曾经为完成一个方法的长参数列表而苦恼?当你因为有一些类似的超载而迷失在中间时,你有什么感觉?此高级功能允许快速搭建完整方法调用的脚手架。
Facilitate ILogger usages
所有与 ILogger 使用相关的样板代码是否让您分心?它会让你的注意力从更重要的事情上移开吗?不再!这组专用重构允许您非常快速地添加日志记录代码。
- ⭐ 自动注入强类型记录器
- ⭐ 用 try-catch 包装并记录异常
- ⭐ 用日志记录范围包裹选定的块
- ⭐ 具有所需严重性的脚手架日志记录方法调用
生成映射方法
使用类型转换器的真实性,根据智能约定自动生成映射逻辑。借助UI 配置器,您可以自定义映射规则以根据您的需要和标准调整映射代码:
- ⭐ 处理不匹配的属性
- ⭐ 自动提取重复逻辑到方法
- ⭐ 在生成的代码中重用现有方法
- ⭐ 由多个对象组成映射
- ⭐ 使用 switch 表达式映射枚举
- ⭐ 将复杂对象映射为平面结构
生成显式转换
您尝试分配给属性、作为方法参数传递或从函数返回的变量类型与预期类型不匹配?您可以节省大量输入并立即使用代码操作修复它以生成显式转换。MappingGenerator可以搭建基于当前上下文执行类型转换所需的所有代码。
- ⭐ 修复变量声明
- ⭐ 修复无效分配
- ⭐ 修复无效的返回语句
- ⭐ 修复无效的 yield return 语句
- ⭐ 修复无效的方法参数
- ⭐ Automatically extract conversion to method
- ⭐ Find and call existing conversion method
Object Scaffolder
Do you need to create an instance of an object that consists of many complex properties? Seems like a lot of typing and it's quite a common task, too! Thanks to the Object Scaffolder you can instantly emit all the necessary code with values generated by one of the predefined strategies.
- ⭐ Option to choose value generation strategy
- ⭐ Automatically match local variables to object properties
- ⭐ Initialize nested objects and collections
- ⭐ Choose between new Type() and new() syntax
- ⭐ Control nesting level
- ⭐ Define the number of elements for collection initialization
- ⭐ Control the order of initialized properties
Invocation Scaffolder
Have you ever been struggling with completing a method's long parameter list? What do you feel when you've got lost in the middle because there are a few similar overloads? This premium feature allows for quick scaffolding of complete method invocation.
- ⭐ Easily choose the desired method overload
- ⭐ Select invocation formatting
- ⭐ Toggle parameters' names
- ⭐ Select strategy for generating parameters' values
- ⭐ Automatically match local variables to parameters
- ⭐ Handle ref and out arguments
Clean-up method invocation
How many times did you come across a messy method invocation and you wasted too much time trying to figure out what was going on there? Thanks to this module you can easily clean up messy method invocations by:
- ⭐ Extracting complex parameters into separate variables
- ⭐ Changing invocation formatting to multi/single line
- ⭐ Toggle parameters' names
Facilitate ILogger usages
Does all that boilerplate code related to ILogger usage distract you? Does it take your attention away from more important things? Not anymore! This set of dedicated refactorings allows you to add logging code very quickly.
- ⭐ Automatically inject strongly typed logger
- ⭐ Wrap with try-catch and log the exception
- ⭐ Wrap the selected block with logging scope
- ⭐ Scaffold logging method invocation with desired severity
Generate mapping method
Automatically generate mapping logic based on smart conventions using verity of type converters. Thanks to the UI Configurator you can customize mapping rules to adjust the mapping code to your needs and standards:
- ⭐ Handle unmatched properties
- ⭐ Automatically extract duplicated logic to method
- ⭐ Re-use existing methods in the generated code
- ⭐ Compose mapping from multiple objects
- ⭐ Map enums using switch expressions
- ⭐ Map complex object into flat structure
Generate explicit conversions
The type of the variable that you are trying to assign to a property, pass as a method parameter or return from the function doesn't match the expected type? You can save a lot of typing and fix that immediately with code action for generating explicit conversion. MappingGenerator can scaffold all the code required for performing conversion between types based on the current context.
- ⭐ Fix variable declarations
- ⭐ Fix invalid assignments
- ⭐ Fix invalid return statements
- ⭐ Fix invalid yield return statements
- ⭐ Fix invalid method argument
- ⭐ Automatically extract conversion to method
- ⭐ Find and call existing conversion method
Object Scaffolder
您是否需要创建包含许多复杂属性的对象实例?似乎要打很多字,这也是一项很常见的任务!多亏了Object Scaffolder,您可以立即发出所有必要的代码,其中包含由一种预定义策略生成的值。
- ⭐ 选择价值生成策略的选项
- ⭐ 自动匹配局部变量到对象属性
- ⭐ 初始化嵌套对象和集合
- ⭐ 在new Type()和new()语法之间选择
- ⭐ 控制嵌套层级
- ⭐ 定义集合初始化的元素个数
- ⭐ 控制初始化属性的顺序
使用高级功能释放真正的生产力
MappingGenerator 最初是免费的开源软件,在此期间创建的所有功能都可以免费使用。但是,通过付费许可证,您可以获得更丰富的功能集。
映射选项
使用专用的 UI 设置面板控制映射代码形状。
即时预览
尝试不同的映射选项并立即在预览框中查看效果。
表情投射
为表示映射投影的字段生成实现。
映射接口
使用一组映射方法定义接口,并通过一次运行生成实现。
额外转换器
使用调整映射边的专用转换器输入更少。
更多匹配规则
使用类型扁平化和一致性匹配规则为发散模型获得更多映射匹配。