protected bool DataExist(WebData_v2 <TSource, TData> webData) { bool dataExists = false; bool useDocumentStore = _store != null && !_desactivateDocumentStore; if (useDocumentStore) { webData.Key = GetDataKey(webData.Request.Data); if (_store.GenerateId) { webData.Id = _store.GetId(webData.Key); if (webData.Id != null) { dataExists = true; } } else { dataExists = _store.Exists(webData.Key); } } return(dataExists); }
private void Load_v2() { //BsonValue id = null; //BsonValue key = null; bool dataExists = false; _dataStore = _webDataManager_v4.DataStore; //_webLoadImageManager = _webDataManager_v4.WebLoadImageManager; bool useDocumentStore = _dataStore != null && !_webDataManager_v4.DesactivateDocumentStore; if (useDocumentStore) { _key = _webDataManager_v4._GetKeyFromHttpRequest(_request.HttpRequest); if (_dataStore.GenerateId) { _id = _dataStore.GetId(_key); if (_id != null) { dataExists = true; } } else { dataExists = _dataStore.Exists(_key); } } if (_dataStore == null || !dataExists || _request.ReloadFromWeb || _request.RefreshDocumentStore) { _LoadFromWeb_v2(_webDataManager_v4.WebLoadDataManager); if (!_result_v2.Success) { return; } } else { _LoadFromDocumentStore_v2(_key); } // _error is not used actually //if (_error) // return; if (_dataStore != null && _dataLoadedFromWeb) { BsonDocument document = Serialize(); if (_dataStore.GenerateId) { if (_id == null) { _id = _dataStore.GetNewId(); } _data.zSetId(_id); _dataStore.SaveWithId(_id, document); } else { _dataStore.SaveWithKey(_key, document); } } //if (_webLoadImageManager == null) // LoadImages_v1(_request.ImageRequest); //else // LoadImages_v3(_request.ImageRequest); //LoadImages_v1(_request.ImageRequest); LoadImages_v3(_request.ImageRequest); }