Esempio n. 1
0
        private void DB_AddOrRemoveElementsFromArrayItem_FireAndForget(
            HttpListenerContext _Context,
            string _QueryType,
            string _Table,
            string _KeyName,
            BPrimitiveType _KeyValue,
            string _ElementName,
            BPrimitiveType[] _ElementValueEntries,
            int _Current_RetryCount = 0)
        {
            var RelevantQueue = new ConcurrentQueue <Action_DeliveryEnsurer>();

            if (!ActionsDictionary.TryAdd(_Context, RelevantQueue))
            {
                RelevantQueue = ActionsDictionary[_Context];
            }
            RelevantQueue.Enqueue(new Action_DeliveryEnsurer_DB_Add_Remove_ElementsToArrayItem()
            {
                QueryType           = _QueryType,
                TableName           = _Table,
                KeyName             = _KeyName,
                KeyValue            = new BPrimitiveType_JStringified(_KeyValue),
                ElementName         = _ElementName,
                ElementValueEntries = BPrimitiveType_JStringified.ConvertPrimitivesToPrimitiveTypeStructs(_ElementValueEntries).ToList(),
                RetryCount          = _Current_RetryCount
            });
        }
Esempio n. 2
0
        private void DB_AddOrRemoveElementsFromArrayItem_FireAndForget_Internal(
            string _QueryType,
            string _Table,
            string _KeyName,
            BPrimitiveType _KeyValue,
            string _ElementName,
            BPrimitiveType[] _ElementValueEntries,
            int _Current_RetryCount             = 0,
            Action <string> _ErrorMessageAction = null)
        {
            if (DatabaseService == null)
            {
                return;
            }

            bool bResult;

            if (_QueryType == Action_DeliveryEnsurer.QUERY_TYPE_DB_ADD_ELEMENTS_TO_ARRAY_ITEM)
            {
                bResult = DatabaseService.AddElementsToArrayItem(_Table, _KeyName, _KeyValue, _ElementName, _ElementValueEntries, out JObject _, EBReturnItemBehaviour.DoNotReturn, null, _ErrorMessageAction);
            }
            else
            {
                bResult = DatabaseService.RemoveElementsFromArrayItem(_Table, _KeyName, _KeyValue, _ElementName, _ElementValueEntries, out JObject _, EBReturnItemBehaviour.DoNotReturn, _ErrorMessageAction);
            }

            if (!bResult)
            {
                BroadcastFailed_FireAndForget_Operation(new Action_DeliveryEnsurer_DB_Add_Remove_ElementsToArrayItem()
                {
                    QueryType           = _QueryType,
                    TableName           = _Table,
                    KeyName             = _KeyName,
                    KeyValue            = new BPrimitiveType_JStringified(_KeyValue),
                    ElementName         = _ElementName,
                    ElementValueEntries = BPrimitiveType_JStringified.ConvertPrimitivesToPrimitiveTypeStructs(_ElementValueEntries).ToList(),
                    RetryCount          = _Current_RetryCount
                }, _ErrorMessageAction);
            }
        }