Asp.net web api 当从本地主机加载数据时,类型提供程序将挂起应用程序
我有理由相信我正在使用的类型提供程序正在挂起我在Android emulator上运行的应用程序 在Xamarin.Forms应用程序的主页上,我有以下加载操作:Asp.net web api 当从本地主机加载数据时,类型提供程序将挂起应用程序,asp.net-web-api,f#,xamarin.android,type-providers,Asp.net Web Api,F#,Xamarin.android,Type Providers,我有理由相信我正在使用的类型提供程序正在挂起我在Android emulator上运行的应用程序 在Xamarin.Forms应用程序的主页上,我有以下加载操作: protected override void OnAppearing() { _viewModel.Load(); return; // Never gets reached when using Type Provider... } public void Load() => Cars = new Obse
protected override void OnAppearing()
{
_viewModel.Load();
return; // Never gets reached when using Type Provider...
}
public void Load() => Cars = new ObservableCollection<Car>(getCars());
open FSharp.Data
// https://forums.xamarin.com/discussion/1199/how-to-make-our-remote-host-127-0-0-1-reachable-from-android-device-monoandroid-using-vs2010
[<Literal>] (* "10.0.2.2" is the workaround IP address for local host *)
let JsonPathDesignTime = "http://localhost:48213/api/cars"
let JsonPathRunTime = "http://10.0.2.2:48213/api/cars"
type Repository = JsonProvider<JsonPathDesignTime>
type Car = { Make:string ; Model:string }
let getCars() =
try
Repository.Load JsonPathRunTime
|> Array.toSeq
|> Seq.map(fun x -> { Make=x.Make ; Model=x.Model })
with error -> failwith error.Message
My viewmodel具有以下加载操作:
protected override void OnAppearing()
{
_viewModel.Load();
return; // Never gets reached when using Type Provider...
}
public void Load() => Cars = new ObservableCollection<Car>(getCars());
open FSharp.Data
// https://forums.xamarin.com/discussion/1199/how-to-make-our-remote-host-127-0-0-1-reachable-from-android-device-monoandroid-using-vs2010
[<Literal>] (* "10.0.2.2" is the workaround IP address for local host *)
let JsonPathDesignTime = "http://localhost:48213/api/cars"
let JsonPathRunTime = "http://10.0.2.2:48213/api/cars"
type Repository = JsonProvider<JsonPathDesignTime>
type Car = { Make:string ; Model:string }
let getCars() =
try
Repository.Load JsonPathRunTime
|> Array.toSeq
|> Seq.map(fun x -> { Make=x.Make ; Model=x.Model })
with error -> failwith error.Message