首页 新闻 会员 周边 捐助

PetaPoco.5.1.223生成T4模板编译不通过

0
悬赏园豆:5 [待解决问题]

使用最新的PetaPoco.5.1.223,是用NuGet引用的,先将Mysql的连接字符串在Appconfig配置后,再引用PetaPoco,之后编辑Database.tt文件,保存就可以生成代码的。但是保存的时候直接就报错了,修改了很多地方都不行,还请有经验者指导一下,谢谢!

 

 

 

appconfig代码

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <configuration>
 3   <connectionStrings>
 4     <add name="WeChat" connectionString="Server=;Database=; User=;Password=;Use Procedure Bodies=true;Charset=utf8;Allow Zero Datetime=True; Pooling=true; Max Pool Size=500;Treat Tiny As Boolean=false" providerName="MySql.Data.MySqlClient"/>
 5   </connectionStrings>
 6 <system.data>
 7     <DbProviderFactories>
 8       <remove invariant="MySql.Data.MySqlClient" />
 9       <add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.9.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
10     </DbProviderFactories>
11   </system.data></configuration>

 

Database.tt代码

复制代码
<#@ include file="PetaPoco.Core.ttinclude" #>
<#
    // Settings
    ConnectionStringName = "WeChat";            // Uses last connection string in config if not specified
    Namespace = "PetapocoMySql";
    RepoName = "WeChat";
    GenerateOperations = true;
    GeneratePocos = true;
    GenerateCommon = true;
    ClassPrefix = "ClassPrefixClassPrefix";
    ClassSuffix = "ClassSuffixClassSuffix";
    TrackModifiedColumns = false;
    ExplicitColumns = true;
    ExcludePrefix = new string[] {}; // Exclude tables by prefix.

    // Read schema
    var tables = LoadTables();


/*
    // Tweak Schema
    tables["tablename"].Ignore = true;                            // To ignore a table
    tables["tablename"].ClassName = "newname";                    // To change the class name of a table
    tables["tablename"]["columnname"].Ignore = true;            // To ignore a column
    tables["tablename"]["columnname"].PropertyName="newname";    // To change the property name of a column
    tables["tablename"]["columnname"].PropertyType="bool";        // To change the property type of a column
*/

    // Generate output
    if (tables.Count>0)
    {
#>
<#@ include file="PetaPoco.Generator.ttinclude" #>
<# } #>
复制代码
 
 
xiao99的主页 xiao99 | 初学一级 | 园豆:188
提问于:2016-08-06 14:25
< >
分享
所有回答(1)
0

删除PetaPoco.Core.ttinclude文件的最后一个空行就好了。

mans | 园豆:202 (菜鸟二级) | 2017-05-16 23:09
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册