/// <summary> /// Configure data portal client to use HttpProxy. /// </summary> /// <param name="config">CslaDataPortalConfiguration object</param> /// <param name="options">Data portal proxy options</param> public static DataPortalClientOptions UseHttpProxy(this DataPortalClientOptions config, Action <Csla.Channels.Http.HttpProxyOptions> options) { var proxyOptions = new Csla.Channels.Http.HttpProxyOptions(); options?.Invoke(proxyOptions); config.Services.AddTransient(typeof(IDataPortalProxy), sp => { var applicationContext = sp.GetRequiredService <ApplicationContext>(); var client = sp.GetRequiredService <HttpClient>(); return(new Csla.Channels.Http.HttpProxy(applicationContext, client, proxyOptions)); }); return(config); }
/// <summary> /// Create an Http Proxy instance for use in testing /// </summary> /// <returns>An instance of Csla.Channels.Http.HttpProxy for use in testing</returns> private Csla.Channels.Http.HttpProxy CreateTestHttpProxy() { Csla.Channels.Http.HttpProxy proxy; Csla.Channels.Http.HttpProxyOptions proxyOptions; System.Net.Http.HttpClient httpClient; var applicationContext = ApplicationContextFactory.CreateTestApplicationContext(); httpClient = new System.Net.Http.HttpClient(); proxyOptions = new Csla.Channels.Http.HttpProxyOptions(); proxy = new Csla.Channels.Http.HttpProxy(applicationContext, httpClient, proxyOptions); return(proxy); }
public CustomProxy(ApplicationContext applicationContext, HttpClient httpClient, Csla.Channels.Http.HttpProxyOptions options) : base(applicationContext, httpClient, options) { base.DataPortalUrl = ServerUrl; }