Пример #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services
            .AddControllersWithViews()
            .AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null)
            .AddDxSampleModelJsonOptions();

            services
            .AddXpoDefaultUnitOfWork(true, options => options
                                     .UseConnectionString(WebApiDataStoreClient.GetConnectionString("https://localhost:44371/xpo/"))
                                                                                                                  //.UseConnectionPool( false )
                                     .UseThreadSafeDataLayer(true)
                                     .UseAutoCreationOption(DevExpress.Xpo.DB.AutoCreateOption.DatabaseAndSchema) // Remove this line if the database already exists
                                     .UseEntityTypes(typeof(AuditorTitle))                                        // Pass all of your persistent object types to this method.
                                     );
        }
Пример #2
0
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

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

            builder.Services.AddScoped(sp => new HttpClient {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            });

            builder.Services.AddXpoDefaultUnitOfWork(true, options =>
                                                     options.UseConnectionString(WebApiDataStoreClient.GetConnectionString("https://localhost:44307/xpo/"))
                                                     .UseConnectionPool(false)
                                                     .UseThreadSafeDataLayer(false)
                                                     .UseEntityTypes(typeof(Customer), typeof(Order)));

            builder.Services.AddDevExpressBlazor();

            await builder.Build().RunAsync();
        }
 void ExecuteLogInCommand()
 {
     try {
         if (IsBusy)
         {
             return;
         }
         IsBusy = true;
         XpoHelper.InitXpo(WebApiDataStoreClient.GetConnectionString("https://10.0.2.2:5001/xpo/"), Login, Password);
         IsBusy = false;
         if (Device.RuntimePlatform == Device.iOS)
         {
             Application.Current.MainPage = new MainPage();
         }
         else
         {
             Application.Current.MainPage = new NavigationPage(new MainPage());
         }
     } catch (Exception ex) {
         Application.Current.MainPage.DisplayAlert("Login failed", ex.Message, "Try again");
     }
 }