示例#1
0
        public static void InitFStore(FStoreConfig fStoreConfig)
        {
            var fStore = new FStoreMono(fStoreConfig);

            if (!fStore.StoreExists())
            {
                fStore.CreateStore();
            }

            var profilesTable = new FSTable(nameof(Profile), IdMode.UserGenerated);             // Single item, Id does not matter but speeds things up

            if (!fStore.TableExists(profilesTable, null))
            {
                fStore.CreateTable(profilesTable);
            }
            FStoreTables.TableConfig[typeof(Profile)] = profilesTable;

            var contactsTable = new FSTable(nameof(Identity), IdMode.UserGenerated);             // Id is necessary to retrieve an item

            if (!fStore.TableExists(contactsTable, null))
            {
                fStore.CreateTable(contactsTable);
            }
            FStoreTables.TableConfig[typeof(Identity)] = contactsTable;

            var messagesTable = new FSTable(nameof(Message), IdMode.Auto, true, true); // e.g. /tbl_Message/1234567890/999999

            if (!fStore.TableExists(messagesTable, null))                              //       /[page: recipientId]/[auto-id]
            {
                fStore.CreateTable(messagesTable);
            }
            FStoreTables.TableConfig[typeof(Message)] = messagesTable;
        }
        public static void InitFStore(FStoreConfig fStoreConfig)
        {
            var fStore = new FStoreMono(fStoreConfig);

            var identitiesTable = new FSTable(nameof(XIdentity), IdMode.UserGenerated); // Id is necessary to retrieve an item

            if (!fStore.TableExists(identitiesTable, null))
            {
                fStore.CreateTable(identitiesTable);
            }
            FStoreTables.TableConfig[typeof(XIdentity)] = identitiesTable;

            var messagesTable = new FSTable(nameof(XMessage), IdMode.UserGenerated, true, false); // e.g. /tbl_XMessage/1234567890/ac59f6f8-6e93-e185-d01a-94220b30d216

            if (!fStore.TableExists(messagesTable, null))
            {
                fStore.CreateTable(messagesTable);
            }
            FStoreTables.TableConfig[typeof(XMessage)] = messagesTable;

            var resendRequestsTable = new FSTable(nameof(XResendRequest), IdMode.UserGenerated, false, false);     // e.g. /tbl_XMessage/1234567890/ac59f6f8-6e93-e185-d01a-94220b30d216

            if (!fStore.TableExists(resendRequestsTable, null))
            {
                fStore.CreateTable(resendRequestsTable);
            }
            FStoreTables.TableConfig[typeof(XResendRequest)] = resendRequestsTable;
        }