modelsbuilder/ModelsBuilder.Original

Extend Builder

Opened this issue · 6 comments

Make it possible to extend the code builder.

Idea: the builder is an IBuilder that is provided by an IBuilderFactory - ppl can register their own factory to supply their own builder, which can be from scratch or inherit from the built-in builder - and customize the generated code.

Experimenting...

bielu commented

@zpqrtbnk if we are creating that in that way, shouldn't we actually also change registrations of CodeFactory to Unique or Collection as to override ICodeModelBuilder we need to override Code factory as part of code of CF is:
public virtual ICodeModelBuilder CreateCodeModelBuilder(ModelsBuilderOptions options, CodeOptions codeOptions) => new CodeModelBuilder(options, codeOptions);

bielu commented

Also you introduced that registration
composition.Register<IBuilderFactory, TextBuilderFactory>(Lifetime.Singleton);
shouldn't be it actually register as unique to allow for overrides?

Have pushed a commit. Is it doing all the things we discussed?

bielu commented

HI Stephan,
looks like you covered all things which we discussed. :) and I think we can move that ticket to ready as it allows already really well for extensions