Giter Site home page Giter Site logo

erikej / efcorepowertools Goto Github PK

View Code? Open in Web Editor NEW
2.0K 49.0 282.0 2.63 GB

Entity Framework Core Power Tools - reverse engineering, migrations and model visualization in Visual Studio & CLI

License: MIT License

C# 99.87% Smalltalk 0.01% Batchfile 0.10% PowerShell 0.01% TSQL 0.01%
entity-framework-core visual-studio entity-framework model-visualization sql-server hacktoberfest dbcontext dotnet visual-studio-extension

efcorepowertools's Introduction

EF Core Power Tools

Reverse engineering, model visualization and migrations UI for EF Core in Visual Studio 2022 (amd64) - and reverse engineering from command line.

Aims to lower the bar for getting started with EF Core, by providing GUI based assistance with reverse engineering of an existing database, creating migrations and visualizing your DbContext model.

Visual Studio Marketplace Rating Visual Studio Marketplace Downloads Twitter Follow

Quick Start and 10 minute intro video

Demo video - Introduction

Demo video - Advanced features

EF Core Power Tools presentation

My tools and utilities for embedded database development

The tool and GitHub based support is free, but I would be very grateful for a rating or review here, and I also appreciate sponsorships

Documentation

Reverse Engineering Quick Start

User guide

Release notes

Downloads/builds

Requirements

.NET Framework 4.8 or later is required. For EF Core reverse engineering, the .NET 6.0 or .NET 8.0 x64 runtime must be installed.

Release

Download the latest version of the Visual Studio extension from Visual Studio MarketPlace

Or simply install from the Extensions dialog in Visual Studio.

I have also published EF Core Power Pack which includes some helpful DDEX providers as well as EF Core Power Tools.

Daily build

You can download the daily build from Open VSIX Gallery

Ensure you always have the latest daily build (if you are brave) by installing this extension

EF Core Power Tools CLI - efcpt

If you do not use Visual Studio, but for example Visual Studio Code, a cross platform dotnet tool for reverse engineering is available, more information here

Related NuGet packages

ErikEJ.EntityFrameworkCore.DgmlBuilder

Adds the AsDgml() extension method to any derived DbContext. The method will create a DGML graph of your DbContext Model, that you can then view in the Visual Studio DGML viewer

ErikEJ.EntityFrameworkCore.SqlServer.Dacpac

Reverse engineer a SQL Server .dacpac with the EF Core tooling

ErikEJ.EntityFrameworkCore.SqlServer.SqlQuery

Materialize abritary classes and scalar values from EF Core using raw SQL

How do I contribute

If you encounter a bug or have a feature request, please use the Issue Tracker. The project is also open for pull requests following standard pull request guidelines

Building and debugging

To build and debug, run latest version of Visual Studio as Administrator with the "Visual Studio extension development workload" installed. Make EFCorePowerTools the startup project, and ensure your build configuration is Debug, AnyCPU.

You can smoke test changes to reverse engineering. Launch one of the efreveng console apps in the debugger using the name of a file in the TestFiles folder as parameter.

In the ScaffoldingTester solution there are scripts to populate Northwind and Chinook databases with the required objects.

Sponsors

A massive thanks to AWS, who sponsors EFCorePowerTools from January 2024 via the .NET on AWS Open Source Software Fund.

And a huge thanks to everyone who sponsors this project through Github sponsors.

efcorepowertools's People

Contributors

304notmodified avatar dependabot[bot] avatar doggy8088 avatar eminmesic avatar erikej avatar herdo avatar jens-brand avatar jespersh avatar julien-vandenbussche avatar jwyza-pi avatar kotentopf1337 avatar layla-p avatar misinformeddna avatar pedromcrocha avatar proh4ck avatar raman-kazhadub avatar raptorcz avatar rasputino avatar ronanj2 avatar rotbarsch avatar rufer7 avatar simoncropp avatar sinankeskin avatar spaasis avatar superflemme avatar theprateik avatar tiomny avatar tjackadams avatar tomzre avatar varorbc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

efcorepowertools's Issues

Extension debugging

Hello!
On the extension debugging, when I hit F5 in 'EFCorePowerTools' project, in the opened VS (experimental instance) I cannot find the extension dialog right clicking a project like the wiki says (netstandard type). How I can debug the extension?

image

Thanks for all and sorry for my English.

Handlebars files not very useful

First off, thank you for your great work on this tool! It is very useful in generating a model from an existing database.

That said, I don't think the handlebars files that EF Core Power Tools generates are particularly useful. They seem to reference elements that are not exposed.

{{> dbimports}}

namespace {{namespace}}
{
    public partial class {{class}} : DbContext
    {
{{> dbsets}}
{{#if entity-type-errors}}
{{#each entity-type-errors}}
{{spaces 8}}{{{entity-type-error}}}
{{/each}}

{{/if}}

{{{on-configuring}}}
{{{on-model-creating}}}
    }
}

In this snippet- only 'dbsets' and 'dbimports' are actually exposed as files. Everything else is just a magic string that is calling some hidden code somewhere. This extremely limits how much we can use this file to customize.

On a related note- this is a Visual Studio extension- so why not use T4 templates instead of handlebar templates? T4 templates are totally transparent as to what is generated and where the data comes from, they are consistent with what the EF6 tooling does, and I also find them much easier to read. These handlebar templates seem much harder to read (since they seem to be inserting spaces with a function, and can just reference magic strings somewhere else)

Handlebars.dll cannot be found

Hi Erick,
I'm getting a missing Handlebars error and I hope that you can help me fix this.

When I try to Reverse Code Engineer, I get an error one the console the Handlebars.dll cannot be found.

System.IO.FileNotFoundException: Could not load file or assembly 'Handlebars, Version=1.9.4.0, Culture=neutral, PublicKeyToken=22225d0bf33cd661' or one of its dependencies. The system cannot find the file specified.
File name: 'Handlebars, Version=1.9.4.0, Culture=neutral, PublicKeyToken=22225d0bf33cd661'
at EntityFrameworkCore.Scaffolding.Handlebars.HbsHelperService.RegisterHelpers()
at EntityFrameworkCore.Scaffolding.Handlebars.HbsCSharpModelGenerator.GenerateModel(IModel model, String namespace, String contextDir, String contextName, String connectionString, ModelCodeGenerationOptions options)
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, IEnumerable1 tables, IEnumerable1 schemas, String namespace, String language, String contextDir, String contextName, ModelReverseEngineerOptions modelOptions, ModelCodeGenerationOptions codeOptions)
at ReverseEngineer20.EfCoreReverseEngineer.GenerateFiles(ReverseEngineerOptions reverseEngineerOptions)
at EFCorePowerTools.Handlers.ReverseEngineerHandler.d__2.MoveNext() in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ReverseEngineerHandler.cs:line 153

Steps to reproduce
Installed the latest daily build
I have a .NET Core 2.1 Class Library project
All needed EntityFrameworkCore dependencies installed
Handlebars.NET nuget package installed.
I'm able to generate Reverse Code without the HandleBars option, but when selecting to use Hndlebars I get the error.

Further technical details
EF Core Power Tools version: 1.0.616.0
Database engine: SQL Server
Visual Studio version: Visual Studio 2017 15.7.3

Enable virtual on preperties to support lazy loading proxies

EF Core 2.1 introduces lazy loading. To use in its easiest configuration requires the collections / properties to be virtual. Am i right in saying this is not currently configurable, or is it something that needs to be done in Handlebars? If it is through handlebars, is it better treated as an option in the main program - this will be a pretty common use case.

https://docs.microsoft.com/en-au/ef/core/querying/related-data#lazy-loading

Can't finnish ADO.NET Entity Data Model wizard SQlite EF6 VS 2017 15.7

From @sheitmann on May 10, 2018 18:1

I try to add a ADO.NET Entity Data Model for SQlite and when I finish the wizard I get an exception message and the following exception in the output window.

Unable to generate the model because of the following exception: 'System.NotSupportedException: Unable to determine the provider name for provider factory of type 'System.Data.SQLite.SQLiteFactory'. Make sure that the ADO.NET provider is installed or registered in the application config.
   at System.Data.Entity.Utilities.DbProviderFactoryExtensions.GetProviderInvariantName(DbProviderFactory factory)
   at System.Data.Entity.Infrastructure.DependencyResolution.DefaultInvariantNameResolver.GetService(Type type, Object key)
   at System.Data.Entity.Infrastructure.DependencyResolution.CachingDependencyResolver.<>c__DisplayClass1.<GetService>b__0(Tuple`2 k)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at System.Data.Entity.Infrastructure.DependencyResolution.CachingDependencyResolver.GetService(Type type, Object key)
   at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(Type type, Object key)
   at System.Data.Entity.Infrastructure.DependencyResolution.RootDependencyResolver.GetService(Type type, Object key)
   at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.<>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(Type type, Object key)
   at System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(Type type, Object key)
   at System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver, Object key)
   at System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInvariantName(DbConnection connection)
   at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader..ctor(EntityConnection entityConnection, Version storeSchemaModelVersion)
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.CreateDbSchemaLoader(EntityConnection connection, Version storeSchemaModelVersion)
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GetStoreSchemaDetails(StoreSchemaConnectionFactory connectionFactory)
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.CreateStoreModel()
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GenerateModel(List`1 errors)
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModels(String storeModelNamespace, ModelBuilderSettings settings, List`1 errors)
   at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModel(ModelBuilderSettings settings, IVsUtils vsUtils, ModelBuilderEngineHostContext `hostContext)'.

Steps to reproduce

I followed all steps from https://github.com/ErikEJ/SqlCeToolbox/wiki/EF6-workflow-with-SQLite-DDEX-provider

I chose Add, New Item, Data, ADO.NET Entity Data Model, EF Designer from Database.
I picked the SQlite Provider, connected to my database, selected all tables and clicked on finnish.

Further technical details

Toolbox/Power Tools version: 4.7.568

Database engine: SQlite

Visual Studio or SSMS version: Visual Studio 2017 15.7.1 Community

my packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.2.0" targetFramework="net471" />
  <package id="System.Data.SQLite" version="1.0.108.0" targetFramework="net471" />
  <package id="System.Data.SQLite.Core" version="1.0.108.0" targetFramework="net471" />
  <package id="System.Data.SQLite.EF6" version="1.0.108.0" targetFramework="net471" />
  <package id="System.Data.SQLite.Linq" version="1.0.108.0" targetFramework="net471" />
</packages>

my config file

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v13.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
    </providers>
  </entityFramework>
  <system.data>
    <DbProviderFactories>
      <remove invariant="System.Data.SQLite.EF6" />
      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
      <remove invariant="System.Data.SQLite" />
    </DbProviderFactories>
  </system.data>
</configuration>

Copied from original issue: ErikEJ/SqlCeToolbox#710

Unable to add new tables to entities

Context and Entities exist already and I want to add one more table to the context. but the context is overriding with the new table added and lost all other entities.

Steps to reproduce

Include a complete description that I can redo to reproduce the issue.

Further technical details

EF Core Power Tools version: (found in About dialog - blue questionmark icon on context menu)
4.7.568.0
Database engine: (SQlite, SQL Compact, SQL Server, Postgres)
SQL Server
Visual Studio version: (e.g. Visual Studio 2017 15.7)
2017

System.MissingMethodException: Method not found: 'Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.EntityFrameworkCore.Design.ServiceCollectionExtensions.AddHandlebarsScaffolding(Microsoft.Extensions.DependencyInjection.IServiceCollection, Microsoft.EntityFrameworkCore.Design.ReverseEngineerOptions, System.ValueTuple`2<System.String,System.Action`3<System.IO.TextWriter,System.Object,System.Object[]>>[])'

Describe what is not working as expected.

Steps to reproduce

Keep getting during reverse engineer even

Further technical details

EF Core Power Tools version: (1.0.622)

System.MissingMethodException: Method not found: 'Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.EntityFrameworkCore.Design.ServiceCollectionExtensions.AddHandlebarsScaffolding(Microsoft.Extensions.DependencyInjection.IServiceCollection, Microsoft.EntityFrameworkCore.Design.ReverseEngineerOptions, System.ValueTuple2<System.String,System.Action3<System.IO.TextWriter,System.Object,System.Object[]>>[])'.
at ReverseEngineer20.EfCoreReverseEngineer.GenerateFiles(ReverseEngineerOptions reverseEngineerOptions)
at EFCorePowerTools.Handlers.ReverseEngineerHandler.d__2.MoveNext() in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ReverseEngineerHandler.cs:line 154

Database engine: (SQL Server)

Visual Studio version: (2017 15.7.3)

Customize Code using Handlebars option is not shown VS2017

From @ydlkrishna on May 19, 2018 4:18

I am using VS2017 15.6.5 and EF Core Power Tools was working fine until couple of days back. Now, when I try to reverse engineer, the option "Customize Code using Handlingbars...." is not shown.

Any help on this highly appreciated....

image

Steps to reproduce

Right click the Class library --> EF Core Power Tools --> Reverse Engineer --> Select SQL Server --> Select tables --> Customize code using handlebars option is missing (Please find attached screenshot)

Further technical details

Toolbox/Power Tools version: 4.7.568.0

Database engine: SQL Server 2017

Visual Studio or SSMS version: Visual Studio 2017 15.6.5

Copied from original issue: ErikEJ/SqlCeToolbox#713

Update Handlebars for 2.1 preview1

From @ErikEJ on March 27, 2018 8:35

Describe what is not working as expected.

Steps to reproduce

Include a complete description that I can redo to reproduce the issue.

Further technical details

Toolbox/Power Tools version: (found in About dialog - blue questionmark icon)

Database engine: (SQlite, SQL Compact or SQL Server)

Visual Studio or SSMS version: (e.g. Visual Studio 2017 15.3, SSMS 17.3)

Copied from original issue: ErikEJ/SqlCeToolbox#666

Method not found: IServiceCollection AddHandlebarsScaffolding

Hi! Great tool, I use it daily for updating my model from db changes. It's the best one I've used so far.
From some days ago, I'm unable to reverse engineer my db. I get the following exception when I try to do so:

System.MissingMethodException: Method not found: 'Microsoft.Extensions.DependencyInjection.IServiceCollection Microsoft.EntityFrameworkCore.Design.ServiceCollectionExtensions.AddHandlebarsScaffolding(Microsoft.Extensions.DependencyInjection.IServiceCollection, Microsoft.EntityFrameworkCore.Design.ReverseEngineerOptions, System.ValueTuple`2<System.String,System.Action`3<System.IO.TextWriter,System.Object,System.Object[]>>[])'.
   at ReverseEngineer20.EfCoreReverseEngineer.GenerateFiles(ReverseEngineerOptions reverseEngineerOptions)
   at EFCorePowerTools.Handlers.ReverseEngineerHandler.<ReverseEngineerCodeFirst>d__2.MoveNext() in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ReverseEngineerHandler.cs:line 153

from the looks of it, it is similar to issue #35

Steps to reproduce

I guess the error started happening when I uninstalled another related tool, but to be honest, I really don't know, so I'm asking for help. This my guess of the steps that would cause it again:

  1. install https://github.com/ErikEJ/SqlCeToolbox
  2. install https://github.com/ErikEJ/EFCorePowerTools
  3. uninstall SqlCeToolbox
  4. right click on project
  5. select ef core power tools -> reverse engineer
  6. click ok in the next 3 modals until the model generation is triggered
  7. The exception is shown on the output window

First I used sqlcetoolbox for a few months. then I had to stop using it due to project requirements, so I went to using the old scaffold-dbcontext. After some months I came across efcorepowertools which made us very happy for some months. and now I'm having this issue. I hope I can go back to using it soon!

Further technical details

EF Core Power Tools version:
Version 1.0.612.0

SQL Server Compact 4.0 in GAC - Yes - 4.0.8876.1
SQL Server Compact 4.0 DbProvider - Yes

SQL Server Compact 4.0 DDEX provider - No
SQL Server Compact 4.0 Simple DDEX provider - Yes

SQLite ADO.NET Provider included: 1.0.107.0
SQLite EF6 DbProvider in GAC - No

System.Data.SQLite DDEX provider - No
SQLite Simple DDEX provider - Yes

Database engine: SQL Server

Visual Studio version: Visual studio enterprise 2017 version 15.6.6

Custom type mapping

From @mbeckenbach on February 3, 2018 9:40

This project is awesome! It feels just like the db first workflow is coming back. But there is one feature that I am really missing.

In EF6 DB First, there is this amazing feature of mapping external types to properties.
This can be perfectly be used for transforming an integer culumn into a C# enum.

EF Core supports enum properties and maps those to integer columns in the database.

When doing a reverse engineer, all integer columns get generated as integer properties as it should be. Then one can simply change a properties type to some enum type, which exists in the project. Works great.

But when repeating the reverse engineer process to update the generated model from database, the file will be overwritten, which removes the modification of the properties type.

So I was thinking about how it would be possible to preserve this modification.

One way of doing this could be to create a code template for a specific class file. I had a look at EntityFrameworkCore.Scaffolding.Handlebars by @tonysneed but I dont see a way for doing this.

Another idea was to extend the efpt.config.json with an array of type mappings, that could be applied after code generation. Could something like that be implemented in your tool?

{
  "ContextClassName": "EfcoretestContext",
  "DatabaseType": 2,
  "IdReplace": false,
  "IncludeConnectionString": true,
  "OutputPath": "Models",
  "ProjectRootNamespace": "EFCoreTest",
  "SelectedToBeGenerated": 0,
  "Tables": [ "dbo.Posts", "dbo.Users" ],
  "UseDatabaseNames": false,
  "UseFluentApiOnly": true,
  "UseHandleBars": true,
  "UseInflector": true,
  "TypeMappings": [
    { "Column": "dbo.Posts.Category", "Type": "Enums.Categories" }
  ]
}

Copied from original issue: ErikEJ/SqlCeToolbox#621

Can there be a way to set a suffix for the generated files?

Thank you Erick for this useful tool.

I'm trying to use it to create my db model, as expected, but I'm also using it to generate DTOs faster.

Would it be possible to add the option to add a suffix(and a prefix) to the generated classes?

I can use handlebars to name the classes my way, with a suffix, but the file names keep the table names.

It would be very useful to be able to set primarily a suffix and also the prefix for the class files.

What are your thoughts about this?

No source code in repo

I was hoping to look through this source code but the repo is empty, other than the license and readme files.

Method not found: AddHandlebarsScaffolding

Hello,
After yesterday, -i am not sure if it is about update- i started get following error. I am trying to run power tool on .net core class library.

System.IO.FileLoadException: Could not load file or assembly 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
at ReverseEngineer20.EfCoreReverseEngineer.GenerateFiles(ReverseEngineerOptions reverseEngineerOptions)
at EFCorePowerTools.Handlers.ReverseEngineerHandler.d__2.MoveNext() in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ReverseEngineerHandler.cs:line 154

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Further technical details

.NET Core 2.0

Visual Studio : 15.7.2

EF Power Tool version :
Version 1.0.603.0
SQL Server Compact 4.0 in GAC - Yes - 4.0.8876.1
SQL Server Compact 4.0 DbProvider - Yes
SQL Server Compact 4.0 DDEX provider - No
SQL Server Compact 4.0 Simple DDEX provider - Yes
SQLite ADO.NET Provider included: 1.0.107.0
SQLite EF6 DbProvider in GAC - No
System.Data.SQLite DDEX provider - No
SQLite Simple DDEX provider - Yes

Remove OnConfiguring from generated Context

I suggest to remove the OnConfiguring method from the default generated code made by EFCorePowerTools.

The generated Context contains an OnConfiguring method that literally contains nothing. Perhaps it contains something with a different set of options than what I am using, but I believe if the method body would be empty it should not generate at all. The reason is that it is impossible to make a partial class that overrides this method if the generated class is overriding it.

//Why do this???- it just means our partial classes can't override this method now
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    if (!optionsBuilder.IsConfigured)
    {
    }
}

Create appveyor build

Describe what is not working as expected.

Steps to reproduce

Include a complete description that I can redo to reproduce the issue.

Further technical details

Toolbox/Power Tools version: (found in About dialog - blue questionmark icon)

Database engine: (SQlite, SQL Compact or SQL Server)

Visual Studio or SSMS version: (e.g. Visual Studio 2017 15.3, SSMS 17.3)

File content not refresh

File content (*.cs) not refresh after file generated from EFCorePowerTools.
I have to re-open the file in order to see the changes.
I dont know which issue is this, either VS2017 or EFCorePowerTools, but one thing for sure, if I change file content outside VS2017 then back to see it in VS2017 (already opened before), it will ask me to re-open the file

Steps to reproduce

  1. Open source code (tableX.cs - for example). tableX is generated file from SQL Server database with EFCorePowerTools
  2. Modify SQL Server table
  3. Generate again with EFCorePowerTools
  4. Dont see any differences
  5. Close the tableX.cs then open again.
  6. See the differences

Further technical details

EF Core Power Tools version: 1.0.604.0
Database engine: SQL Server 2017 CU5 - Docker Version
Visual Studio version: VS2017 15.7.3 and VS2017 v15.8 preview 1

Add DbContext Model Diagram FileNotFoundException

Add DbContext Model Diagram generates the following error:

System.ArgumentException: Error:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore.Sqlite, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.EntityFrameworkCore.Sqlite, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' ---> System.IO.FileNotFoundException: Could not load the specified file.
File name: 'Microsoft.EntityFrameworkCore.Sqlite'
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at Jeopardy.DataAccess.JeopardyGameContext.OnConfiguring(DbContextOptionsBuilder optionsBuilder)
at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
at Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure1 accessor) at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(Func1 factory)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType)
at ReverseEngineer20.EfCoreModelBuilder.BuildResult(String outputPath, Boolean generateDdl) in C:\Code\EFCorePowerTools\src\GUI\efpt\EFCoreModelBuilder.cs:line 40
at ReverseEngineer20.Program.Main(String[] args) in C:\Code\EFCorePowerTools\src\GUI\efpt\Program.cs:line 40

Parameter name: processResult
at EFCorePowerTools.Handlers.ModelAnalyzerHandler.Generate(String outputPath, Project project, GenerationType generationType) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ModelAnalyzerHandler.cs:line 51

Steps to reproduce

Tutorial here: https://docs.microsoft.com/en-us/ef/core/get-started/uwp/getting-started
Install EF Core Power Tools
Right Click on Solution -> EF Core Power Tools -> Add DbContext Model Diagram

Further technical details

EF Core Power Tools version: 1.0.604
SQlite
Visual Studio 2017 15.7.3
Microsoft.EntityFrameworkCore.SqlLite: 2.0.1
Microsoft.EntityFrameworkCore.Tools: 2.0.1

Update issue_template

Describe what is not working as expected.

Steps to reproduce

Include a complete description that I can redo to reproduce the issue.

Further technical details

Toolbox/Power Tools version: (found in About dialog - blue questionmark icon)

Database engine: (SQlite, SQL Compact or SQL Server)

Visual Studio or SSMS version: (e.g. Visual Studio 2017 15.3, SSMS 17.3)

Unable to use with a project that targets x64

I'm not sure if this is a bug or intentional design but if it is the latter I'm hoping for a workaround if you know of one.

I have a .NET class library that targets x64 as its build target. Whenever I try to do "View DbContext Model DDL SQL" from the EFCore Power Tools (EFCPT) menu the build fails with the error that it cannot load my file or assembly because it was "compiled for a different processor"

If I change the build target to "Any CPU", then EFCPT works fine. Unfortunately I cannot change the target of my project for other reasons.

Steps to reproduce

  1. Take that sample project I gave you in Issue #52 (which you just fixed, thank you).
  2. In Project Properties >> Build Change the "Platform Target" to "x64".
  3. Build the project - it builds
  4. From the EFCore Power Tools context menu, choose "View DbContext Model DDL SQL". You will get the following output:

System.ArgumentException: Error:
System.BadImageFormatException: Could not load file or assembly 'TestEFPowerTools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. This assembly was compiled for a different processor.
at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
at System.Reflection.Assembly.LoadFile(String path)
at ReverseEngineer20.EfCoreModelBuilder.Load(String assemblyPath)
at ReverseEngineer20.EfCoreModelBuilder.GetOperations(String outputPath)
at ReverseEngineer20.EfCoreModelBuilder.BuildResult(String outputPath, Boolean generateDdl)
at ReverseEngineer20.EfCoreModelBuilder.GenerateDatabaseCreateScript(String outputPath)
at ReverseEngineer20.Program.Main(String[] args)

Parameter name: processResult
at EFCorePowerTools.Handlers.ModelAnalyzerHandler.Generate(String outputPath, Project project, GenerationType generationType) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ModelAnalyzerHandler.cs:line 49

Further technical details

EF Core Power Tools version: Version 1.0.618.0
SQL Server Compact 4.0 in GAC - Yes - 4.0.8876.1
SQL Server Compact 4.0 DbProvider - Yes
SQL Server Compact 4.0 DDEX provider - No
SQL Server Compact 4.0 Simple DDEX provider - Yes
SQLite ADO.NET Provider included: 1.0.107.0
SQLite EF6 DbProvider in GAC - No
System.Data.SQLite DDEX provider - No
SQLite Simple DDEX provider - Yes
Database engine: (SQlite, SQL Compact, SQL Server, Postgres)
Visual Studio version: 15.7.3

Making EF Core even more easy for beginners

Considering the code-first approach.
Starting with defining entities in a 'Model' project, using DataAnnotations.
In your 'Data' project, it would be nice to have the option via the power tools,
to 'Create DbContext'.
This would create the DbContext class, and generate DbSet for each class in the appointed 'Model' namespace.

I know, it's not that hard to create a DbContext yourself, while you model your entities, but, a little help can be useful :)

What are your thoughts on this?

investigate possibility for custom naming of dbset, classes and properties

From @ErikEJ on February 22, 2018 9:10

https://github.com/aspnet/EntityFrameworkCore/blob/dev/src/EFCore.Design/Scaffolding/Internal/RelationalScaffoldingModelFactory.cs

dotnet/efcore#11056 (comment)

  • Get PR for ICandidateNamingService accepted
  • Add support for efpt.renaming.json (drop empty, commented out sample in project, in there is none)
  • add class for renames ColumnRenamer: Table, Old, New & TableRenamer: Old, New
  • Override ICandiadteNamingService, and rename based on json file

Copied from original issue: ErikEJ/SqlCeToolbox#640

Add dbContext model diagram not wroking when dbcontext inherits from IdentityDbContext<T>

From @hafeefshaik on February 7, 2018 4:57

Getting below error:

System.ArgumentException: Error:
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.AspNetCore.Identity.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
File name: 'Microsoft.AspNetCore.Identity.EntityFrameworkCore, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' ---> System.IO.FileNotFoundException: Could not load the specified file.
File name: 'Microsoft.AspNetCore.Identity.EntityFrameworkCore'
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingEvent(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.ResolveUsingResolvingEvent(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit)
at System.Attribute.GetCustomAttributes(MemberInfo element, Type type, Boolean inherit)
at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.<>c.b__12_5(TypeInfo t)
at System.Linq.Enumerable.WhereSelectListIterator2.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext()
at System.Linq.Enumerable.ConcatIterator1.MoveNext() at System.Linq.Enumerable.DistinctIterator1.MoveNext()
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.FindContextTypes()
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.GetContextTypes()
at ReverseEngineer20.EfCoreModelBuilder.GetDbContextTypes(DbContextOperations operations) in C:\Code\SqlCeToolbox\src\GUI\ReverseEngineer20\EFCoreModelBuilder.cs:line 72
at ReverseEngineer20.EfCoreModelBuilder.BuildResult(String outputPath, Boolean generateDdl) in C:\Code\SqlCeToolbox\src\GUI\ReverseEngineer20\EFCoreModelBuilder.cs:line 32
at ReverseEngineer20.Program.Main(String[] args) in C:\Code\SqlCeToolbox\src\GUI\efpt\Program.cs:line 26

Parameter name: processResult
at EFCorePowerTools.Handlers.ModelAnalyzerHandler.Generate(String outputPath, Project project, GenerationType generationType) in C:\projects\sqlcetoolbox\src\GUI\EFCorePowerTools\Handlers\ModelAnalyzerHandler.cs:line 52

Add DbContext Model Diagram is not working as expect.

Steps to reproduce

To reproduce the issue, create a empty .net core project. and add a datacontext which is inherit form IdentityDbContext, then run the migrations, then try to generate the dbcontext diagram.

Database engine: (SQlite, SQL Compact or SQL Server)

Visual Studio or SSMS version: (e.g. Visual Studio 2017 15.3, SSMS 17.3)

Copied from original issue: ErikEJ/SqlCeToolbox#628

No EF Core DbContext types found in the project

When I attempted to add a DbContext model diagram, I received the following error:

System.ArgumentException: No EF Core DbContext types found in the project
   at ReverseEngineer20.EfCoreModelBuilder.GetDbContextTypes(DbContextOperations operations) in C:\Code\EFCorePowerTools\src\GUI\efpt\EFCoreModelBuilder.cs:line 76
   at ReverseEngineer20.EfCoreModelBuilder.BuildResult(String outputPath, Boolean generateDdl) in C:\Code\EFCorePowerTools\src\GUI\efpt\EFCoreModelBuilder.cs:line 34
   at ReverseEngineer20.Program.Main(String[] args) in C:\Code\EFCorePowerTools\src\GUI\efpt\Program.cs:line 44

Parameter name: processResult
   at EFCorePowerTools.Handlers.ModelAnalyzerHandler.Generate(String outputPath, Project project, GenerationType generationType) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ModelAnalyzerHandler.cs:line 49

The same error occurred when executing any of the other DbContext related commands in EF Core Power Tools, even though a DbContext does indeed exist in the project.

Further technical details

EF Core Power Tools version: 1.0.617

Database engine: SQL Server

Visual Studio version: Visual Studio 2017 15.7.4

Overwriting option on the existing models on select/deselect tables

And also, is there any way to overwrite the existing models when we modify the models by select/unselect the tables?

Steps to reproduce

Include a complete description that I can redo to reproduce the issue.

Further technical details

Toolbox/Power Tools version: 4.7.568.0

Database engine: SQL Server 2017

Visual Studio or SSMS version: Visual Studio 2017 15.6.5

How to compile?

Describe what is not working as expected.

Steps to reproduce

  1. Clone Github code
  2. Open using Visual Studio 2017
  3. Click on Build
  4. It will asks for Running Custom Tool for Template (T4), click Yes
  5. Build Error, it cant find Microsoft.SqlServer.TransactSql.ScriptDom version 13.100
    I'm trying to search within files but it still can't find Microsoft.SqlServer.TransactSql.ScriptDom with version 13.100, because currently I'm using version 14.0.0.0

Thanks

Further technical details

EF Core Power Tools version: Havent tried it yet
Database engine: (SQlite, SQL Compact, SQL Server, Postgres) : SQL Server
Visual Studio version: (e.g. Visual Studio 2017 15.7) : VS 2017

Inital migration needed for migration tool

Opening the migrations tool without having a single migration yet results in error message.

Steps to reproduce

Include a complete description that I can redo to reproduce the issue.

Further technical details

EF Core Power Tools version: (found in About dialog - blue questionmark icon on context menu)

599


Microsoft Visual Studio

EF Core Power Tools

Error:

System.ArgumentException: Absolute path information is required.

Parameter name: path

at System.Reflection.Assembly.LoadFile(String path)

at ReverseEngineer20.EfCoreModelBuilder.GetOperations(String outputPath) in C:\Code\EFCorePowerTools\src\GUI\ReverseEngineer20\EFCoreModelBuilder.cs:line 83

at ReverseEngineer20.EfCoreModelBuilder.BuildResult(String outputPath, Boolean generateDdl) in C:\Code\EFCorePowerTools\src\GUI\ReverseEngineer20\EFCoreModelBuilder.cs:line 34

at ReverseEngineer20.Program.Main(String[] args) in C:\Code\EFCorePowerTools\src\GUI\efpt\Program.cs:line 40

Database engine: (SQlite, SQL Compact, SQL Server, Postgres)
sql server (localdb)

Visual Studio version: (e.g. Visual Studio 2017 15.7)
15.7.2

It would be awesome to have the tool create a db context from a given model (namespace). I feel that is missing. Reverse engineering works very good. Just could use some help in code first scenario

Move over issues

Describe what is not working as expected.

Steps to reproduce

Include a complete description that I can redo to reproduce the issue.

Further technical details

Toolbox/Power Tools version: (found in About dialog - blue questionmark icon)

Database engine: (SQlite, SQL Compact or SQL Server)

Visual Studio or SSMS version: (e.g. Visual Studio 2017 15.3, SSMS 17.3)

Error about dependency on System.ValueTuple 4.0.2.0

I've been unable to make any of the EF Core Power Tools run for days so I've tried to boil the problem down to something simple. (In my normal project, the error is that my assembly using EF "was compiled for a different processor". My project is must build for x64 if that matters)

Anyway I created a test project test project to test/reproduce this problem, and the error changed. Now it's this:: "Could not load file or assembly 'System.ValueTuple, Version 4.0.2.0".

That version of ValueTuple is not even available at nuget.org (only 4.3 or later) so I don't know how to fix either of them.

Steps to reproduce

  1. Create a new shared library project in VS 2017
  2. Install the following from the packages: Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.Tools,
  3. Install the latest build of EFCorePowerTools
  4. Create a data class (call it "Part")
  5. Create a DbContext-derived class that exposes a property that is DbSet
  6. Verify that you can successfully Add-Migration and Update-Database from the Package Manager console
  7. Verify that those steps successfully created the database
  8. Right Click on the project in solution explorer and, choose "EF Core PowerTools >> View DbContext Model DDL SQL

The output window (I've pasted the full stack trace below) complains about a missing System.ValueTuple, version 4.0.2.0. If you try to add that from nuget, it won't work because the oldest version available there is 4.3.0

(I was forced to go with the latest build of EFCorePowerTools because the one available from NuGet.org appears to require EntityFrameworkCore 2.0 and I'm using 2.1)

Further technical details

EntityFrameworkCore version 2.1
EF Core Power Tools Info:

Version 1.0.616.0

SQL Server Compact 4.0 in GAC - Yes - 4.0.8876.1
SQL Server Compact 4.0 DbProvider - Yes

SQL Server Compact 4.0 DDEX provider - No
SQL Server Compact 4.0 Simple DDEX provider - Yes

SQLite ADO.NET Provider included: 1.0.107.0
SQLite EF6 DbProvider in GAC - No

System.Data.SQLite DDEX provider - No
SQLite Simple DDEX provider - Yes

Database engine: SQLServer local DB

Visual Studio Community 2017 version 4.7.02556

Full output of error when I try to issue the EFCorePowerTools command:

========== Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========

System.ArgumentException: Error:
System.IO.FileLoadException: Could not load file or assembly 'System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.ValueTuple, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' ---> System.IO.FileLoadException: Could not load file or assembly 'System.ValueTuple, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.ValueTuple, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

at Microsoft.EntityFrameworkCore.Storage.ValueConversion.ValueConverterSelector..ctor(ValueConverterSelectorDependencies dependencies)
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkRelationalServicesBuilder.<>c.b__3_1(IServiceProvider p)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider provider)
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.CreateModel()
at Microsoft.EntityFrameworkCore.Internal.DbContextServices.get_Model()
at Microsoft.EntityFrameworkCore.Infrastructure.EntityFrameworkServicesBuilder.<>c.b__7_1(IServiceProvider p)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.EntityFrameworkCore.DbContext.get_DbContextDependencies()
at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
at Microsoft.EntityFrameworkCore.DbContext.Microsoft.EntityFrameworkCore.Infrastructure.IInfrastructure<System.IServiceProvider>.get_Instance()
at Microsoft.EntityFrameworkCore.Internal.InternalAccessorExtensions.GetService[TService](IInfrastructure1 accessor) at Microsoft.EntityFrameworkCore.Infrastructure.AccessorExtensions.GetService[TService](IInfrastructure1 accessor)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(Func`1 factory)
at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType)
at ReverseEngineer20.EfCoreModelBuilder.BuildResult(String outputPath, Boolean generateDdl)
at ReverseEngineer20.EfCoreModelBuilder.GenerateDebugView(String outputPath)
at ReverseEngineer20.Program.Main(String[] args)

Parameter name: processResult
at EFCorePowerTools.Handlers.ModelAnalyzerHandler.Generate(String outputPath, Project project, GenerationType generationType) in C:\projects\efcorepowertools\src\GUI\EFCorePowerTools\Handlers\ModelAnalyzerHandler.cs:line 49

Update available notification not cleared after updating

Describe what is not working as expected.

I keep seeing this notification in vs 2017 ce, 15.7.3

image

Is this because I subscribed to daily/nightly builds? (vsx gallery). But anyway, immediately after updating, it appears again (while other update notifications have disappeared).

UPDATE:
This happens on 3 pcs. On Insider and Regular builds of Windows. In Preview and Regular version of VS.
Am I the only one seeing this?

Possibility to introduce templating for on-model-creating method

From @mbharodia on April 12, 2018 13:46

Here is handle bar template for DbContext

{{> dbimports}}
namespace {{namespace}}
{
public partial class {{class}} : DbContext
{
{{> dbsets}}
{{#if entity-type-errors}}
{{#each entity-type-errors}}
{{spaces 8}}{{{entity-type-error}}}
{{/each}}
{{/if}}
{{{on-configuring}}}
{{{on-model-creating}}}
}
}

on-model-creating injects

protected override void OnModelCreating(ModelBuilder modelBuilder)

I like to do the following

protected override void OnModelCreating(ModelBuilder modelBuilder)
{

  `//code generated by the tool goes here//`

  `//my own code that I could add using template//`
  `OnModelCreatingPartial(modelBuilder);`

}

The way template has been designed right now, I am not able to inject the following (or I may not know)

OnModelCreatingPartial(modelBuilder)

Here is my updated template to introduce partial method

{{> dbimports}}
namespace {{namespace}}
{
public partial class {{class}} : DbContext
{
{{> dbsets}}
{{#if entity-type-errors}}
{{#each entity-type-errors}}
{{spaces 8}}{{{entity-type-error}}}
{{/each}}
{{/if}}
{{{on-configuring}}}
{{{on-model-creating}}}
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
}
}

As DbContext is partial class already, I can have another partial class and add required code as per my requirements. I think this provides me an easier way to extend the functionality using PARTIAL setup.

I think the above is already available in EF6 POCO Generated and it has been useful to me in many instances. I am just wondering whether there is any possibility of doing the same thing.

I highly appreciate your recommendation or feedback or any help in this regard

Copied from original issue: ErikEJ/SqlCeToolbox#695

Migrations UI: Update EF Core Unicorn image (to be better sized)

Describe what is not working as expected.

Steps to reproduce

Include a complete description that I can redo to reproduce the issue.

Further technical details

EF Core Power Tools version: (found in About dialog - blue questionmark icon on context menu)

Database engine: (SQlite, SQL Compact, SQL Server, Postgres)

Visual Studio version: (e.g. Visual Studio 2017 15.7)

Reverse Engineer Fails with SQL Server 2008

From @matthewDDennis on May 7, 2018 19:44

System.Data.SqlClient.SqlException (0x80131904): 'CONCAT' is not a recognized built-in function name.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader() at Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqlServerDatabaseModelFactory.GetTables(DbConnection connection, Func3 tableFilter, IReadOnlyDictionary2 typeAliases) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqlServerDatabaseModelFactory.Create(DbConnection connection, IEnumerable1 tables, IEnumerable1 schemas) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqlServerDatabaseModelFactory.Create(String connectionString, IEnumerable1 tables, IEnumerable1 schemas) at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ReverseEngineerScaffolder.ScaffoldModel(String connectionString, IEnumerable1 tables, IEnumerable`1 schemas, String namespace, String language, String outputDbContextDir, String contextName, Boolean useDataAnnotations, Boolean useDatabaseNames)
at ReverseEngineer20.EfCoreReverseEngineer.GenerateFiles(ReverseEngineerOptions reverseEngineerOptions)
at EFCorePowerTools.Handlers.ReverseEngineerHandler.d__2.MoveNext() in C:\projects\sqlcetoolbox\src\GUI\EFCorePowerTools\Handlers\ReverseEngineerHandler.cs:line 157
ClientConnectionId:26b0c024-00ad-446e-8746-fd229c61a88c
Error Number:195,State:10,Class:15

Copied from original issue: ErikEJ/SqlCeToolbox#706

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.