Exemple #1
0
 /// <summary>
 /// Executes the provided <paramref name="query"/> against the data provider and returns the first result of the set
 /// </summary>
 /// <param name="query">The query to be executed against the provider. The query parameters references should be named with '@' prefix</param>
 /// <param name="parameters">(optional) A dynamic object containing the parameters used in the query</param>
 /// <param name="queryCache">(optional) The query cache to be used for the query</param>
 /// <param name="cacheParameters">(optional) The cache parameters that'll be replaced in the query</param>
 /// <returns>An enumeration of <typeparamref name="T"/></returns>
 public static T QuerySingle(string query, object parameters = null, QueryCache queryCache = null, object[] cacheParameters = null)
 {
     if (queryCache != null)
     {
         queryCache.ParameterValues = cacheParameters;
     }
     using (var manager = new DotEntityQueryManager(queryCache))
     {
         return(manager.DoSingle <T>(query, parameters));
     }
 }
 internal DotEntityQueryManager(QueryCache cache) : this()
 {
     _queryCache = cache;
 }
Exemple #3
0
 IEntitySet <T> IEntitySet <T> .WithQueryCache(QueryCache cache, params object[] parameterValues)
 {
     _cache = cache;
     _cache.ParameterValues = parameterValues;
     return(this);
 }
Exemple #4
0
 /// <summary>
 /// Specifies that the query should be picked up from the cache provided.  This is useful to execute multiple queries with same signature. All the expressions in such queries are evaluated only once
 /// </summary>
 /// <param name="cache">The query cache to use</param>
 /// <param name="parameterValues">The parameter values to be replaced in the cached query</param>
 /// <returns>An implementation object of type <see cref="IEntitySet{T}"/></returns>
 public static IEntitySet <T> WithQueryCache(QueryCache cache, params object[] parameterValues)
 {
     return(Instance.WithQueryCache(cache, parameterValues));
 }