gpt4 book ai didi

mysql - Entity Framework Reverse Engineer Code First 可以和 MySql 一起使用吗?

转载 作者:行者123 更新时间:2023-11-29 01:43:10 24 4
gpt4 key购买 nike

我在 Win 7 Ultimate SP1 和 EF Power Tools 上使用 MS Visual Studio 2012 Update 1 .

我正在尝试在 MySql 数据库上使用 Entity Framework 的逆向工程代码优先功能。我可以成功连接到数据库,但是当它尝试完成代码生成时,出现以下错误:

System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.DbContextPackage.Extensions.ProjectExtensions.InstallPackage(Project project, String packageId)
at Microsoft.DbContextPackage.Handlers.ReverseEngineerCodeFirstHandler.ReverseEngineerCodeFirst(Project project)

One or more errors occurred while processing template 'Entity.tt'.
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude(1,4) : error : A processor named 'T4VSHost' could not be found for the directive named 'CleanupBehavior'. The transformation will not be run. The following Exception was thrown:
System.InvalidOperationException: Cannot find processor for directive 'T4VSHost'.
at Microsoft.DbContextPackage.Utilities.EfTextTemplateHost.Microsoft.VisualStudio.TextTemplating.ITextTemplatingEngineHost.ResolveDirectiveProcessor(String processorName)
at Microsoft.VisualStudio.TextTemplating.Engine.ProcessCustomDirectives(ITextTemplatingEngineHost host, TemplateProcessingSession session, IEnumerable`1 directivesToBeProcessed)

我无法使用我的 google foo 找到任何信息。

最佳答案

目前这是 Entity Framework 的一个活跃错误。 bug详情可见here .

目前有 2 种解决方法,下面是我使用的一种。

打开 C# 文件:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.CS.ttinclude

或对于 VB.net:

C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\Templates\Includes\EF.Utility.VB.ttinclude

并删除第一行:

<#@ CleanupBehavior Processor="T4VSHost" CleanupAfterProcessingTemplate="true" #>

关于mysql - Entity Framework Reverse Engineer Code First 可以和 MySql 一起使用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14063923/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com