【问题标题】:SQLiteAsyncConnection -> CreateTablesAsync<T>() requires two type argumentsSQLiteAsyncConnection -> CreateTablesAsync<T>() 需要两个类型参数
【发布时间】:2018-08-10 03:33:30
【问题描述】:

OS/X Mac Xamarin Forms Visual Studio Pro 2017

我正在尝试学习 Mosh Hamedani 关于 Xamarin 表单的精彩课程。我尝试编写第 89 课中的相同代码:

var connection = DependencyService.Get<ISQLiteDb>().GetConnection();
connection.CreateTablesAsync<Recipe>();

但是...我得到了错误:

使用泛型方法... CreateTablesAsync () 需要 2 类型参数

但即使是Xamarin documentation 也不会这么说!它仅显示您希望创建表的表类类型的一个类型参数。

我该如何解决这个问题?

【问题讨论】:

  • 您使用的是 CreateTableAsync 还是 CreateTablesAsync?

标签: xamarin.forms sqlite-net-pcl


【解决方案1】:

CreateTablesAsync&lt;T1,T2&gt; 需要 2 个类型参数。

CreateTableAsync&lt;T1&gt; 只需要 1 个类型参数。

您可能有错字 - 删除“s”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-06-05
    • 2017-10-23
    • 1970-01-01
    • 2018-11-13
    • 2018-12-08
    • 1970-01-01
    • 2017-12-05
    相关资源
    最近更新 更多