Dapper Rainbow - 如何在另一个模式中指定表名

标签 dapper dapper-rainbow

我对 Dapper Rainbow 还很陌生,所以我可能会遗漏一些明显的东西。是否可以指定表名,如果可以,如何指定?

我尝试了以下但没有运气。

public class DashboardContext : Database<DashboardContext>
{
    public DashboardContext()
    {
       this.DashboardResults = new Table<DashboardResult>(this, "Monitor.DashboardResult");
    }

    public Table<DashboardResult> DashboardResults { get; set; }
}

最佳答案

我有同样的问题,但代码中似乎有错误。我刚刚评论了为表(Database.cs)设置构造函数的行,它可以工作。

    internal void InitDatabase(DbConnection connection, int commandTimeout)
    {
        this.connection = connection;
        //this.commandTimeout = commandTimeout;
        //if (tableConstructor == null)
        //{
        //    tableConstructor = CreateTableConstructorForTable();
        //}

        //tableConstructor(this as TDatabase);
    }

我想这不是最好的解决方案......

关于Dapper Rainbow - 如何在另一个模式中指定表名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12424092/

相关文章:

orm - Dapper.Rainbow VS Dapper.Contrib

c# - 如何让 Dapper.Rainbow 在 SQLite 中使用 AutoIncrement 插入到表中?

c# - Dapper.Rainbow 与现有的数据库模式

c# - Dapper.SimpleCRUD 没有标识的插入问题

c# - 你能说出为什么 DapperExtensions Update 方法执行失败吗?

c# - 不使用匿名对象时 Dapper 动态参数抛出 SQLException "must define scalar variable"

c# - 如果与 async/await 一起使用(使用 Dapper 从 SQL Server 流式传输数据),返回 IEnumerable 会发生什么情况?

.net - Dapper:找不到方法: 'System.Collections.Generic.IEnumerable` 1&lt;!!0> GridReader.Read(Boolean)'