TrackableEntities / EntityFrameworkCore.Scaffolding.Handlebars

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

Consolidate CSharp and TypeScript Generation and allow for other templates directories and file extensions #159

Closed JohnGoldInc closed 3 years ago

JohnGoldInc commented 3 years ago

Describe your proposed changes

Put Closes #XXXX in your comment Closes #158

JohnGoldInc commented 3 years ago

@tonysneed what you think?

tonysneed commented 3 years ago

Hi @JohnGoldInc, Please see my response to your issue #158.

tonysneed commented 3 years ago

Closing this PR as out of scope for this project. @JohnGoldInc As I described here, you have the option of pursuing this effort on your fork.

JohnGoldInc commented 3 years ago

@tonysneed Ok Playing with making my own Scaffolder for my purposes

What is the trick to getting access to "Internal" namespaces to inherit and so on? I.E. using Microsoft.EntityFrameworkCore.Design.Internal; using Microsoft.EntityFrameworkCore.Scaffolding.Internal;

both have red underlines under Internal even though I have installed the NuGet packages:

Microsoft.EntityFrameworkCore.SqlServer Microsoft.EntityFrameworkCore.Design Microsoft.EntityFrameworkCore.Abstractions

Not seeing how to make it happen...

Was thinking it had to do with solution / project naming but naming it "EntityFrameworkCore.Scaffolding.JohnGoldInc" did not solve.

Is it signing the project that does the trick?

tonysneed commented 3 years ago

You don’t have to do anything special to access members of Internal spaces. The classes are public. What warning / error are you getting?

Thanks, Tony

On Apr 18, 2021, at 7:34 PM, John Gold Inc @.***> wrote:

 @tonysneed Ok Playing with making my own Scaffolder for my purposes

What is the trick to getting access to "Internal" namespaces to inherit and so on? I.E. using Microsoft.EntityFrameworkCore.Design.Internal; using Microsoft.EntityFrameworkCore.Scaffolding.Internal;

both have red underlines under Internal even though I have installed the NuGet packages:

Microsoft.EntityFrameworkCore.SqlServer Microsoft.EntityFrameworkCore.Design Microsoft.EntityFrameworkCore.Abstractions

Not seeing how to make it happen...

Was thinking it had to do with solution / project naming but naming it "EntityFrameworkCore.Scaffolding.JohnGoldInc" did not solve.

Is it signing the project that does the trick?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

JohnGoldInc commented 3 years ago

@tonysneed I Get:

The type or namespace name 'Internal' does not exist in the namespace 'Microsoft.EntityFrameworkCore.Design' (are you missing an assembly reference?)
he type or namespace name 'Internal' does not exist in the namespace 'Microsoft.EntityFrameworkCore.Scaffolding' (are you missing an assembly reference?)
The type or namespace name 'ICSharpDbContextGenerator' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'CSharpDbContextGenerator' could not be found (are you missing a using directive or an assembly reference?)  

for the code

using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Scaffolding;
using System.Globalization;
using System.IO;
using JetBrains.Annotations;
using Microsoft.EntityFrameworkCore.Design.Internal;
using Microsoft.EntityFrameworkCore.Internal;
using Microsoft.EntityFrameworkCore.Scaffolding.Internal;
using Microsoft.EntityFrameworkCore.Storage.Internal;

namespace EntityFrameworkCore.Sacffolding.JohnGoldInc
{
    public class ScaffoldingDesignTimeServices : IDesignTimeServices
    {
        public void ConfigureDesignTimeServices(IServiceCollection services)
        {
            services.AddScoped<ICSharpDbContextGenerator, CSharpDbContextGenerator>();
        }
    }
}

even though my project has both EntityFrameworkCore packages used in EntityFrameworkCore.Scaffolding.Handlebars.csproj

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net5.0</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="5.0.5" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.5">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.5" />
  </ItemGroup>

</Project>
JohnGoldInc commented 3 years ago

@tonysneed Nevemind Found it

<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.5">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>

needs to be

<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.5"/>

It auto did the top one, when I added via nuget