BL 工具包 + T4代+ MySQL数据库

发布于 2025-01-01 06:54:29 字数 1648 浏览 0 评论 0原文

我在运行 T4 模板时收到异常:

Running transformation: System.ArgumentNullException: Value cannot be null.
Parameter name: type
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at Microsoft.VisualStudio.TextTemplatingB9C41E12E53D4F3972EB874C0B96FDFD.GeneratedTextTransformation.GetConnection()
   at Microsoft.VisualStudio.TextTemplatingB9C41E12E53D4F3972EB874C0B96FDFD.GeneratedTextTransformation.LoadServerMetadata()
   at Microsoft.VisualStudio.TextTemplatingB9C41E12E53D4F3972EB874C0B96FDFD.GeneratedTextTransformation.LoadMetadata()
   at Microsoft.VisualStudio.TextTemplatingB9C41E12E53D4F3972EB874C0B96FDFD.GeneratedTextTransformation.GenerateModel()
   at Microsoft.VisualStudio.TextTemplatingB9C41E12E53D4F3972EB874C0B96FDFD.GeneratedTextTransformation.TransformText()
   at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result)

这是我的 T4 文件:

<#@ template language="C#v3.5"         #>
<#@ output extension=".generated.cs"   #>
<#@ include file="BLToolkit.ttinclude" #>
<#@ include file="MySql.ttinclude"    #>
<#
    ConnectionString     = "Server=localhost;Port=3306;Database=accounting;Uid=root;pwd=1;";
    DataProviderAssembly = @"D:\Temp\BLToolKitMySql\BLToolKitMySql\mysql.data.dll";

    Namespace       = "BLToolKitMySql";
    DataContextName = "DataModel";
    GenerateModel();
#>

我添加了所有引用,例如: BLtoolkit.3 、 Bltoolkit.Data.DataProvider.MySql3 、 mysql.data 、 sys.data.linq 和 MySqlDataProvider.cs

I receive an exception running my T4 template:

Running transformation: System.ArgumentNullException: Value cannot be null.
Parameter name: type
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at Microsoft.VisualStudio.TextTemplatingB9C41E12E53D4F3972EB874C0B96FDFD.GeneratedTextTransformation.GetConnection()
   at Microsoft.VisualStudio.TextTemplatingB9C41E12E53D4F3972EB874C0B96FDFD.GeneratedTextTransformation.LoadServerMetadata()
   at Microsoft.VisualStudio.TextTemplatingB9C41E12E53D4F3972EB874C0B96FDFD.GeneratedTextTransformation.LoadMetadata()
   at Microsoft.VisualStudio.TextTemplatingB9C41E12E53D4F3972EB874C0B96FDFD.GeneratedTextTransformation.GenerateModel()
   at Microsoft.VisualStudio.TextTemplatingB9C41E12E53D4F3972EB874C0B96FDFD.GeneratedTextTransformation.TransformText()
   at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result)

this is my T4 file:

<#@ template language="C#v3.5"         #>
<#@ output extension=".generated.cs"   #>
<#@ include file="BLToolkit.ttinclude" #>
<#@ include file="MySql.ttinclude"    #>
<#
    ConnectionString     = "Server=localhost;Port=3306;Database=accounting;Uid=root;pwd=1;";
    DataProviderAssembly = @"D:\Temp\BLToolKitMySql\BLToolKitMySql\mysql.data.dll";

    Namespace       = "BLToolKitMySql";
    DataContextName = "DataModel";
    GenerateModel();
#>

I added all references like: BLtoolkit.3 , Bltoolkit.Data.DataProvider.MySql3 , mysql.data , sys.data.linq and MySqlDataProvider.cs

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一曲爱恨情仇 2025-01-08 06:54:29

看来MySQL连接无法实例化。
我必须更正 MySql.ttinclude 文件:已更改

ConnectionType = "MySql.Data.MySqlClient.MySqlConnection, MySql.Data";

ConnectionType = "MySql.Data.MySqlClient.MySqlConnection, mysql.data";

It seems that the MySQL connection can't be instanciated.
I had to correct the MySql.ttinclude file : changed

ConnectionType = "MySql.Data.MySqlClient.MySqlConnection, MySql.Data";

to

ConnectionType = "MySql.Data.MySqlClient.MySqlConnection, mysql.data";

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文