TrackableEntities / EntityFrameworkCore.Scaffolding.Handlebars

Scaffold EF Core models using Handlebars templates.
MIT License
209 stars 53 forks source link

Cannot run reverse engineering in ef core 3 with handlebars #94

Closed LeDucThang closed 4 years ago

LeDucThang commented 4 years ago

Enviroment

    {
        public void ConfigureDesignTimeServices(IServiceCollection serviceCollection)
        {
            serviceCollection.AddHandlebarsScaffolding(options =>
            {
                options.ReverseEngineerOptions = ReverseEngineerOptions.DbContextAndEntities;
            });
            serviceCollection.AddHandlebarsTransformers(
                entityNameTransformer: x => x + "DAO",
                entityFileNameTransformer: x => x + "DAO",
                constructorTransformer: e => new EntityPropertyInfo(e.PropertyType + "DAO", e.PropertyName),
                navPropertyTransformer: e => new EntityPropertyInfo(e.PropertyType + "DAO", e.PropertyName)
            );
        }
    }

dotnet ef dbcontext scaffold "data source=.;initial catalog=WeGift;persist security info=True;user id=sa;password=123456a@;multipleactiveresultsets=True;" Microsoft.EntityFrameworkCore.SqlServer -c DataContext -o Models -f --no-build --use-database-names --json

ERROR Method 'WriteCode' in type 'EntityFrameworkCore.Scaffolding.Handlebars.NullCSharpDbContextGenerator' from assembly 'EntityFrameworkCore.Scaffolding.Handlebars, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b10b51e7b9be6a2e' does not have an implementation.

what did i miss in this code ?

dharmaturtle commented 4 years ago

Try my PR: https://github.com/TrackableEntities/EntityFrameworkCore.Scaffolding.Handlebars/pull/93

tonysneed commented 4 years ago

Fixed by #97.