[Kdbndp][DbFirst]为什么DbFirst.IsCreateAttribute()创建的文件并没有包含字段? 返回

SqlSugar 沟通中
5 183

Nuget信息:

SqlSugarCore 5.1.4.205

代码如下:

using (var db = new SqlSugarClient(new ConnectionConfig()

{

    ConnectionString = "xxx",

    DbType = SqlSugar.DbType.Kdbndp,

    IsAutoCloseConnection = true,

    InitKeyType = InitKeyType.Attribute,

}))

{

    db.DbFirst.IsCreateAttribute(true).StringNullable()

        .CreateClassFile(@"YYY", "ABC.Entities");

}

生成的表cs如下:

    [SugarTable("MD_Unit")]

    public partial class MD_Unit

    {

           public MD_Unit(){



           }


    }


热忱回答5

  • fate sta fate sta VIP0
    1个月前

    database mode没有配置吧

    0 回复
  • fate sta fate sta VIP0
    1个月前

    或者账号权限不够

    0 回复
  • anycat` anycat` VIP0
    1个月前

    @fate sta:感谢,但添加后,还是报错了:

    代码:

    using (var db = new SqlSugarClient(new ConnectionConfig()

    {

        ConnectionString = "xxx",

        DbType = SqlSugar.DbType.Kdbndp,

        IsAutoCloseConnection = true,

        InitKeyType = InitKeyType.Attribute,

        MoreSettings = new ConnMoreSettings()

        {

            DatabaseModel = DbType.PostgreSQL

        }

    }))

    {

        db.DbFirst.IsCreateAttribute(true).StringNullable()

            .CreateClassFile(@"YYY", "ABC.Entities");

    }



    错误信息:

    SqlSugar.SqlSugarException:“中文提示 :  连接数据库过程中发生错误,检查服务器是否正常连接字符串是否正确,错误信息:Exception while reading from streamDbType="Kdbndp";ConfigId="".

    English Message : Connection open error . Exception while reading from streamDbType="Kdbndp";ConfigId="" ”


    0 回复
  • fate sta fate sta VIP0
    1个月前
    //可以查看安装的模式
    show database_mode;
    
    //查看版本号
    SELECT version();
    0 回复
  • fate sta fate sta VIP0
    1个月前

    发一下这个信息

    0 回复