BL 工具包 + T4代+ MySQL数据库
我在运行 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来MySQL连接无法实例化。
我必须更正 MySql.ttinclude 文件:已更改
到
It seems that the MySQL connection can't be instanciated.
I had to correct the MySql.ttinclude file : changed
to