/// <summary> /// Executes INSERT operation. /// </summary> /// <typeparam name="T">Type of the entity.</typeparam> /// <param name="queryEndpoint">The query endpoint.</param> /// <param name="evaluator">The expression, tha specify new values.</param> /// <returns>Key of the created entity.</returns> public static Key Insert <T>(this QueryEndpoint queryEndpoint, Expression <Func <T> > evaluator) where T : Entity { var operation = new InsertOperation <T>(queryEndpoint.Provider, evaluator); operation.Execute(); return(operation.Key); }
/// <summary> /// Asynchronously executes INSERT operation. /// </summary> /// <remarks>Multiple active operations in the same session instance are not supported. Use /// <see langword="await"/> to ensure that all asynchronous operations have completed before calling /// another method in this session.</remarks> /// <typeparam name="T">Type of the entity.</typeparam> /// <param name="queryEndpoint">The query endpoint.</param> /// <param name="evaluator">The expression, tha specify new values.</param> /// <param name="token">The cancellation token to terminate execution if necessary.</param> /// <returns>Key of the created entity.</returns> public static async Task <Key> InsertAsync <T>(this QueryEndpoint queryEndpoint, Expression <Func <T> > evaluator, CancellationToken token = default) where T : Entity { var operation = new InsertOperation <T>(queryEndpoint.Provider, evaluator); await operation.ExecuteAsync(token).ConfigureAwait(false); return(operation.Key); }
public CompiledQueryRunner(QueryEndpoint endpoint, object queryKey, object queryTarget) { session = endpoint.Provider.Session; domain = session.Domain; this.endpoint = endpoint; this.queryKey = new Pair <object, string>(queryKey, session.StorageNodeId); this.queryTarget = queryTarget; }
private static IServiceCollection TryAddQueryEndpoint( this IServiceCollection services, QueryEndpoint queryEndpoint) { foreach (var service in services) { if (service.ServiceType == typeof(QueryEndpoint)) { var endpoint = (QueryEndpoint)service.ImplementationInstance !; if (endpoint.Name == queryEndpoint.Name) { return(services); } } } services.AddSingleton(queryEndpoint); return(services); }
private IQueryable <Invoice> GetFutureSequenceQueryFake(QueryEndpoint queryEndpoint) { return(null); }
private IQueryable <Invoice> GetFutureSequenceQuery(QueryEndpoint queryEndpoint) { return(Session.Demand().Query.All <Invoice>().Where(o => o.Commission > SearchedCommission)); }
private IQueryable <Customer> GetCustomers(ImpersonationContext context, QueryEndpoint query) { return(query.All <Customer>() .Where(c => c.Branch == Branch)); }
/// <summary> /// Starting point for every query for localizable entities. /// </summary> /// <typeparam name="TTarget">The type of the target.</typeparam> /// <typeparam name="TLocalization">The type of the localization.</typeparam> /// <returns></returns> public static IQueryable <LocalizationPair <TTarget, TLocalization> > All <TTarget, TLocalization>(this QueryEndpoint query) where TTarget : Entity where TLocalization : Localization <TTarget> { return(from target in query.All <TTarget>() join localization in query.All <TLocalization>() on target equals localization.Target where localization.CultureName == LocalizationContext.Current.CultureName select new LocalizationPair <TTarget, TLocalization>(target, localization)); }
private static IQueryable <VipCustomer> GetVipCustomers(ImpersonationContext context, QueryEndpoint query) { return(query.All <VipCustomer>().Where(v => v.Reason != "Relative")); }
private static IQueryable <Customer> GetCustomers(ImpersonationContext context, QueryEndpoint query) { return(query.All <Customer>()); }
/// <summary> /// Initializes a new instance of the <see cref="SecureQueryRootBuilder"/> class. /// </summary> /// <param name="session">The session.</param> /// <param name="origin">The original <see cref="QueryEndpoint"/> instance.</param> public SecureQueryRootBuilder(Session session, QueryEndpoint origin) { this.session = session; InsecureQuery = origin; }
private static IQueryable <Customer> GetCustomers(ImpersonationContext context, QueryEndpoint query) { return(query.All <Customer>() .Where(c => c.IsAutomobileIndustry)); }
private static IQueryable <Customer> GetQuery(QueryEndpoint qe, string filter) { var customers = qe.All <Customer>().Where(cn => cn.CompanyName.StartsWith(filter)); return(customers); }
public FilteringRootBuilder(QueryEndpoint query) { this.query = query; }
private static IQueryable <Customer> GetCustomers(ImpersonationContext context, QueryEndpoint query) { return(query.All <Customer>() .Where(c => c.IsVip == false)); }