Exemplo n.º 1
0
        protected override async void OnInitialized()
        {
            InitializeComponent();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
            //var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            //var filePath = Path.Combine(documentsPath, "xpoXamarinDemo.db");
            // string connectionString = SQLiteConnectionProvider.GetConnectionString(filePath) + ";Cache=Shared;";
            XPOWebApi.Register();
            var connectionString = XPOWebApi.GetConnectionString("http://10.0.2.2/BitServer", string.Empty, "db1");

            ////string connectionString = MSSqlConnectionProvider.GetConnectionString("XAFERPC", "hector", "root", "XafBackend");
            XpoHelper.InitXpo(connectionString);

            await NavigationService.NavigateAsync("NavigationPage/MainPage");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Press any key to start");
            Console.ReadKey();

            XPOWebApi.Register();

            var connectionString = XPOWebApi.GetConnectionString("http://192.168.122.101/BitServer", string.Empty, "db1");


            XpoHelper.InitXpo(connectionString);



            using (var UoW = XpoHelper.CreateUnitOfWork())
            {
                if (UoW.Query <Contact>().Count() == 0)
                {
                    Contact Joche = new Contact(UoW)
                    {
                        Name = "Jose Manuel Ojeda Melgar", Phone = "+7897654321"
                    };
                    Contact Javier = new Contact(UoW)
                    {
                        Name = "Jose Javier Columbie", Phone = "+1897654321"
                    };
                    Contact Jaime = new Contact(UoW)
                    {
                        Name = "Jaime Macias", Phone = "+123423431"
                    };
                    Contact Rafael = new Contact(UoW)
                    {
                        Name = "Rafael Gonzales", Phone = "+14305345345"
                    };
                }

                if (UoW.InTransaction)
                {
                    UoW.CommitChanges();
                }
            }


            Console.WriteLine("Hello World XPO!");
        }
Exemplo n.º 3
0
        protected override async void OnInitialized()
        {
            InitializeComponent();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);

            //MSSqlServer

            //string connectionString = MSSqlConnectionProvider.GetConnectionString("YOUR_SERVER_NAME", "sa", "", "XamarinDemo");

            //SQLite

            var    filePath         = Path.Combine(documentsPath, "xpoXamarinDemo.db");
            string connectionString = SQLiteConnectionProvider.GetConnectionString(filePath) + ";Cache=Shared;";

            //In-memory data store with saving/loading from the xml file

            //var filePath = Path.Combine(documentsPath, "xpoXamarinDemo.xml");
            //string connectionString = InMemoryDataStore.GetConnectionString(filePath);


            //DevExpress.Xpo.SimpleDataLayer.SuppressReentrancyAndThreadSafetyCheck = true;

            XPOWebApi.Register();

            connectionString = XPOWebApi.GetConnectionString("http://192.168.122.101/BitServer", string.Empty, "db1");


            XpoHelper.InitXpo(connectionString);



            using (var UoW = XpoHelper.CreateUnitOfWork())
            {
                if (UoW.Query <Contact>().Count() == 0)
                {
                    Contact Joche = new Contact(UoW)
                    {
                        Name = "Jose Manuel Ojeda Melgar", Phone = "+7897654321"
                    };
                    Contact Javier = new Contact(UoW)
                    {
                        Name = "Jose Javier Columbie", Phone = "+1897654321"
                    };
                    Contact Jaime = new Contact(UoW)
                    {
                        Name = "Jaime Macias", Phone = "+123423431"
                    };
                    Contact Rafael = new Contact(UoW)
                    {
                        Name = "Rafael Gonzales", Phone = "+14305345345"
                    };
                }

                if (UoW.InTransaction)
                {
                    UoW.CommitChanges();
                }
            }

            await NavigationService.NavigateAsync("NavigationPage/ContactList");
        }