private static IQueryable <string> GetTextContent(EPRTR.ResourceProviders.DBCMSTextDataContext db, string resource, string culture, string resourceType) { try { var qGetAboutPageContent = from c in db.ReviseResourceValues where c.CultureCode == culture join ce in db.ReviseResourceKeys on c.ResourceKeyID equals ce.ResourceKeyID where ce.ResourceKey == resource && ce.ResourceType == resourceType select c.ResourceValue; return(qGetAboutPageContent); } catch (Exception ex) { //Log err: LogEntry enlog = new LogEntry(); enlog.EventId = 302; enlog.Categories.Add("Text"); enlog.Message = "Error with LINQ query qGetAboutPageContent: " + ex.Message; enlog.Severity = TraceEventType.Error; enlog.Priority = 1; Logger.Write(enlog); throw; } }
private static string GetText(EPRTR.ResourceProviders.DBCMSTextDataContext db, string resource, string culture, string resourceType) { string myString = string.Empty; //Should be only one result returned, but just in case, we loop thru foreach (var item in GetTextContent(db, resource, culture, resourceType).LinqCache(db, resource + resourceType + culture)) { myString = item; } // if (GetTextContent(db, resource, culture, resourceType).Count() >= 2) { //Log that text is missing: LogEntry enlog = new LogEntry(); enlog.EventId = 302; enlog.Message = String.Format("Text for {0} in language {1} returns more than one result. ", resource, culture); enlog.Severity = TraceEventType.Information; enlog.Categories.Add("Text"); enlog.Priority = 1; Logger.Write(enlog); } return(myString); }