static void Main(string[] args)
        {
            Console.WriteLine("Press any key to start");
            Console.ReadKey();

            SyncDataStore SyncDataStore = new SyncDataStore("ConsoleApp", true, "http://localhost/BIT.Xpo.Sync.ServerNew/api/Sync", null);


            string localDatabaseConnectionString = AccessConnectionProvider.GetConnectionString("LocalDatabase.mdb");
            string logDatabaseConnectionString   = AccessConnectionProvider.GetConnectionString("LogDatabase.mdb");



            SyncDataStore.Initialize(
                localDatabaseConnectionString,
                logDatabaseConnectionString, false, AutoCreateOption.DatabaseAndSchema
                , new Assembly[] { typeof(Demo.ORM.CustomBaseObject).Assembly });


            Console.WriteLine("Pulling data from the api");
            var Transactions = SyncDataStore.PullModificationsFromApi();

            Console.WriteLine($"{Transactions} transactions pulled from the API");
            XpoDefault.DataLayer = new SimpleDataLayer(SyncDataStore);

            Console.WriteLine("Creating customers");
            DemoData();
            Console.WriteLine("Pushing data from the api");
            SyncDataStore.PushModificationsToApi();
            Console.WriteLine("Done!!");
            Console.ReadKey();
        }
Esempio n. 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            var           LogConnectionString   = Configuration.GetConnectionString("LogConnectionString");
            var           LocalConnectionString = Configuration.GetConnectionString("ConnectionString");
            SyncDataStore syncDataStore         = new SyncDataStore("Master");

            syncDataStore.Initialize(LocalConnectionString, LogConnectionString, true, DevExpress.Xpo.DB.AutoCreateOption.DatabaseAndSchema, new Assembly[] { typeof(Customer).Assembly });
            SyncDataStore.EnableTransactionHistory = true;
            services.AddSyncDataStore(syncDataStore);
        }
        protected override async void OnInitialized()
        {
            InitializeComponent();



            Connectivity.ConnectivityChanged += Connectivity_ConnectivityChanged;



            DataStore = new SyncDataStore(Identity, false, "http://192.168.1.64/BIT.Xpo.Sync.ServerNew/api/Sync");

            try
            {
                var MainPath    = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
                var CacheShared = ";Cache=Shared;";
                var MainDb      = Path.Combine(MainPath, "MainDb.db");
                Debug.WriteLine(string.Format("{0}:{1}", "MainDb", MainDb));
                var Log = Path.Combine(MainPath, "Log.db");
                Debug.WriteLine(string.Format("{0}:{1}", "Log", Log));



                DataStore.Initialize(

                    SQLiteConnectionProvider.GetConnectionString(MainDb) + CacheShared,
                    SQLiteConnectionProvider.GetConnectionString(Log) + CacheShared, true, AutoCreateOption.DatabaseAndSchema, new Assembly[] { typeof(Demo.ORM.CustomBaseObject).Assembly });
                XpoDefault.DataLayer = new SimpleDataLayer(DataStore);

                SyncDataStore.EnableTransactionHistory = true;
                DataStore.PullModification();

                UnitOfWork UoW = new UnitOfWork();
                CreateInitialData(UoW);
            }
            catch (Exception exception)
            {
                Debug.WriteLine(string.Format("{0}:{1}", "exception.Message", exception.Message));
                if (exception.InnerException != null)
                {
                    Debug.WriteLine(string.Format("{0}:{1}", "exception.InnerException.Message", exception.InnerException.Message));
                }
                Debug.WriteLine(string.Format("{0}:{1}", " exception.StackTrace", exception.StackTrace));
            }



            await NavigationService.NavigateAsync("NavigationPage/MainPage");
        }
 public void Initialize(XPDictionary dictionary, string LocalDatabase, string LogDatabase)
 {
     //proxy.Initialize(new Assembly[] { this.GetType().Assembly }, legacyConnectionString, tempConnectionString);
     DataStore.Initialize(LocalDatabase, LogDatabase, false, DevExpress.Xpo.DB.AutoCreateOption.DatabaseAndSchema, _Assemblies);
     IsInitialized = true;
 }