IClrTypeMapping 与 ClrTypeMappingDescriptor
IClrTypeMapping vs ClrTypeMappingDescriptor
我是 F#(.NETCore2.0/Ubuntu) 的新用户,我正在尝试将它与 Elasticsearch 一起使用。在一个快速实验室中,我正在尝试为每个类型定义定义一个索引。
open System
open Nest
type Test = {
Id: int
FirstName: string
FullName: string
}
[<EntryPoint>]
let main argv =
// Configuration
let node = new Uri("http://127.0.0.1:9200")
let settings = new ConnectionSettings(node)
settings.DefaultIndex("index-default")
settings.DefaultMappingFor<Test>(fun m-> m.IndexName("test-index")) |> ignore
let testeDoc = {
Id=1;
FirstName="Lucas";
FullName="Peixoto";
}
但我一直收到错误消息:
This expression was expected to have type 'IClrTypeMapping<Test>' but
here has type 'ClrTypeMappingDescriptor<Test>'
我应该为每个索引打开很多请求吗?我怎样才能在此处 return IClrTypeMapping?
重新发布作为回答:
尝试将此添加到表达式 :> IClrTypeMapping<Test>
。需要显式转换接口类型。
我是 F#(.NETCore2.0/Ubuntu) 的新用户,我正在尝试将它与 Elasticsearch 一起使用。在一个快速实验室中,我正在尝试为每个类型定义定义一个索引。
open System
open Nest
type Test = {
Id: int
FirstName: string
FullName: string
}
[<EntryPoint>]
let main argv =
// Configuration
let node = new Uri("http://127.0.0.1:9200")
let settings = new ConnectionSettings(node)
settings.DefaultIndex("index-default")
settings.DefaultMappingFor<Test>(fun m-> m.IndexName("test-index")) |> ignore
let testeDoc = {
Id=1;
FirstName="Lucas";
FullName="Peixoto";
}
但我一直收到错误消息:
This expression was expected to have type 'IClrTypeMapping<Test>' but
here has type 'ClrTypeMappingDescriptor<Test>'
我应该为每个索引打开很多请求吗?我怎样才能在此处 return IClrTypeMapping?
重新发布作为回答:
尝试将此添加到表达式 :> IClrTypeMapping<Test>
。需要显式转换接口类型。