public DataSource RouteQuery(Model.ArticleQuery query) { int targetDsId = query.DataSourceId; DataSourceCreator dsCreator = null; if (_routingTable.TryGetValue(targetDsId, out dsCreator)) { DataSource createdDs = dsCreator(query); return(createdDs); } else { string errorMsg = String.Format("Error when trying to route the request: System cannot find the data source with ID = {0}", targetDsId); throw new InvalidOperationException(errorMsg); } }
public Model.Article GetBestMatch(Model.ArticleQuery query) { return(_dbContext.Articles.FirstOrDefault(x => x.Key == query.QueryText)); }