Closed aeslinger0 closed 5 years ago
Hi
Thanks for suggestion. I have a few questions on start: where the extension method should be added? Should I generate a separated static class? How the class should be named?
Actually, I should be able to use your first example to generate the extension method body and then I can just add this
before the parameter manually.
Or maybe your tool already supports it? I'd start with something like this:
public static class WidgetMap
{
public static WidgetEntity ToWidgetEntity(this WidgetModel model)
{
throw new NotImplementedException();
}
}
And then just run your tool as normal. But I'm not able to get your extension to work at all. The lightbulb icon doesn't have your menu item in it. I'm using VS Community 2017. Is that supported? Do I need to be targeting a certain framework?
I've just tested it on extension method and it works. I'm using Visual Studio 15.8.4. Make sure that you restarted VS after extension installation. Community version should be supported.
Please let me know if the restart didn't help (the concrete version of VS would be helpful)
I tried uninstalling and reinstalling the extension, restarting VS, and rebooting my computer. I was using VS 15.5.1. I updated to 15.8.4 and now it works! Not sure if it was that specific version of VS that wasn't working or if something got corrupted and updating fixed it. Either way, I'm ready to start killing off AutoMapper! I'll let you know if I run into any issues with the extension. Thanks!
As I remember there was an Update of VS which broke the roslyn analyzers, probably I was 15.5.1 I'm glad that you finally managed to make it work.
Looks like a great tool. I think a good enhancement would be to generate the mapping code as an extension method.
userEntity.ToUserDTO()