コード例 #1
0
        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);
            }
        }
コード例 #2
0
 public Model.Article GetBestMatch(Model.ArticleQuery query)
 {
     return(_dbContext.Articles.FirstOrDefault(x => x.Key == query.QueryText));
 }