modelsbuilder / ModelsBuilder.Original

The Community Models Builder for Umbraco
MIT License
114 stars 49 forks source link

Extend Builder #216

Open zpqrtbnk opened 5 years ago

zpqrtbnk commented 5 years ago

Make it possible to extend the code builder.

zpqrtbnk commented 5 years ago

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 4 years ago

@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 4 years ago

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

bielu commented 4 years ago

@zpqrtbnk

zpqrtbnk commented 4 years ago

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

bielu commented 4 years ago

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