我使用FSharp中的库为Windows,Android和iOS制作了PCL。我终于让SqlDataProvider工作,但每当我编写代码以尝试访问查询中的实体的属性时,模块声明会显示一条错误,指出在System.ComponentModel上找不到ICustomTypeDescriptor。此外,我没有得到任何关于交易实体的属性的智能感知。
module CashFlowData
open FSharp.Data.Sql
open System.IO
open System
open CashFlow
let [<Literal>] resolutionPath = __SOURCE_DIRECTORY__ + "\packages\System.Data.SQLite.dll";
let [<Literal>] connectionString = "DataSource=" + __SOURCE_DIRECTORY__ + @"\CashFlowDb.sqlite3;Version=3"
type private sql = SqlDataProvider<
ConnectionString = connectionString,
DatabaseVendor = Common.DatabaseProviderTypes.SQLITE,
SQLiteLibrary = Common.SQLiteLibrary.SystemDataSQLite,
ResolutionPath = resolutionPath,
UseOptionTypes = true>
let ctx = sql.GetDataContext()
let transactions (period : Period) (budget : Budget) =
query {
for transaction in ctx.Main.Transaction do
where (transaction.Date <= period.End && transaction.Date >= period.End
&& transaction.Fk_BudgetId = budget.Id)
select transaction
}