public static void Test_RapideDdl_MongoUpdateDetailItemList_02(string query) { RapideDdl_LoadPostDetail.CurrentLoadPostDetail.UpdateDocuments( post => { Trace.WriteLine("update document \"{0}\"", post.sourceUrl); post.id = RapideDdl_LoadPostDetailFromWebManager.GetPostDetailKey(post.sourceUrl); }, query); //if (query == null) // query = "{}"; //string sort = "{ 'download.creationDate': -1 }"; //foreach (RapideDdl_PostDetail post in RapideDdl_LoadPostDetail.Find(query, sort: sort)) //{ // Trace.WriteLine("update post {0}", post.sourceUrl); // BsonPBSerializationProvider.RegisterSerializer(typeof(ZValue), typeof(ZValueSerializer)); // BsonPBSerializationProvider.RegisterSerializer(typeof(ZInt), typeof(ZIntSerializer)); // BsonPBSerializationProvider.RegisterSerializer(typeof(ZString), typeof(ZStringSerializer)); // try // { // RapideDdl_LoadPostDetail.DocumentStore.SaveDocument(RapideDdl_LoadPostDetail.GetPostDetailKey(post.sourceUrl), post); // } // finally // { // BsonPBSerializationProvider.UnregisterSerializer(typeof(ZValue)); // BsonPBSerializationProvider.UnregisterSerializer(typeof(ZInt)); // BsonPBSerializationProvider.UnregisterSerializer(typeof(ZString)); // } //} }
protected override int GetKeyFromUrl(string url) { return(RapideDdl_LoadPostDetailFromWebManager.GetPostDetailKey(url)); }
public static UrlCache_v1 GetUrlCache() { UrlCache_v1 urlCache = null; if (__useUrlCache) { urlCache = new UrlCache_v1(__cacheDirectory, __urlFileNameType, (url, requestParameters) => (RapideDdl_LoadPostDetailFromWebManager.GetPostDetailKey(url) / 1000 * 1000).ToString()); } return(urlCache); }