cezarypiatek / MappingGenerator

:arrows_counterclockwise: "AutoMapper" like, Roslyn based, code fix provider that allows to generate mapping code in design time.
https://marketplace.visualstudio.com/items?itemName=54748ff9-45fc-43c2-8ec5-cf7912bc3b84.mappinggenerator
MIT License
1.03k stars 119 forks source link

Source Generators #140

Open MatthewSteeples opened 3 years ago

MatthewSteeples commented 3 years ago

Coming with the .NET 5 wave, I think this extension would fit in really well with that so that mappings are generated at compile time. This would ensure they are always up to date, don't need to be checked in to source control etc while still maintaining the simplicity and speed of having precompiled code

Is this something you are planning on incorporating, or would you be happy to take a contribution with it in? I'd be more than happy to give it a go

cezarypiatek commented 3 years ago

Hi

Yes, I was planning to create a source generator when this technology gets an official release. I guess that MappingGenerator.OnBuildGenerator could be quite easily converted to Source Generator. Any contributions are welcomed.

cezarypiatek commented 3 years ago

I make an attempt to create a SourceGenerator but this is a blocker for me https://github.com/dotnet/roslyn/issues/43821

MortenChristiansen commented 3 years ago

@cezarypiatek I just found this repo because it has the same name as my own - I have been exploring source generators to implement a Map method for a couple weeks now at this repo, if you're interested. Mind you its not quite ready for production. I guess I'll have to find a different name before I start publishing it as a NuGet package :) I'll be interested to see what you come up with if you get past the blocker.

Serg046 commented 3 years ago

I started to work on this but finally realized that current code base is quite dependent on SyntaxGenerator which is not avalaible for source generators. Then found this one https://github.com/dotnet/roslyn/issues/43821 where the owner already discussed that. So we either wait for SyntaxGenerator to be exposed somehow or create a new abstraction for generation.