예제 #1
0
        private void ServiceConnect()
        {
            // value from App.config file
            string appServiceUrl = this.ReadSetting(ODATA_SERVICE_APP_KEY);

            if (string.IsNullOrEmpty(appServiceUrl))
            {
                // Refactor
                this.gridView.IsEnabled   = false;
                this.statusInfo.Text      = "Invalid Web Service URL.";
                this.btnAceptar.IsEnabled = false;

                return;
            }
            try
            {
                /* Uri serviceUrl = new Uri(ODATA_SERVICE_URL_JAVA); */
                Uri serviceUrl = new Uri(appServiceUrl);

                this.context = new ODataExample(serviceUrl);

                context.Format.UseJson();

                this.serviceContext = new ODataServiceContext(this.context);
            }
            catch (Exception ex)
            {
                this.statusInfo.Text = ex.Message;
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: uzbekdev1/Joker
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.Logging.SetMinimumLevel(LogLevel.Error);

            var httpClient = new HttpClient {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            };

            var serviceModel = await ODataServiceContext.GetServiceModelAsync(httpClient);

            ConfigureContainer(builder, serviceModel);

            builder.RootComponents.Add <App>("app");

            builder.Services.AddTransient(sp => httpClient);

            builder.Services.AddODataClient().AddHttpClient(httpClient);

            await builder.Build().RunAsync();
        }
예제 #3
0
파일: Program.cs 프로젝트: phachem/Joker
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.Logging.SetMinimumLevel(LogLevel.Error);

            var odataUrl = builder.Configuration["ODataUrl"];

            var httpClient = new HttpClient {
                BaseAddress = new Uri(odataUrl)
            };

            var serviceModel = await ODataServiceContext.GetServiceModelAsync(httpClient);

            ConfigureContainer(builder, serviceModel);

            builder.RootComponents.Add <App>("app");

            builder.Services.AddScoped(sp => httpClient);

            await builder.Build().RunAsync();
        }
예제 #4
0
 public PeopleController()
 {
     _ctx = new ODataServiceContext();
 }