/// <summary> /// Query and return first data /// </summary> /// <typeparam name="T">Data type.</typeparam> /// <returns>First data</returns> public T QueryFirst <T>() { T target = _context.QueryDataDefineSingle <T>(DataEntityMapping.GetEntityMapping(typeof(T)), _level, _command, 0, null, null); Callback(); return(target); }
/// <summary> /// Query and return data list /// </summary> /// <typeparam name="T">Data type.</typeparam> /// <param name="region">Query region</param> /// <param name="cancellationToken">CancellationToken.</param> /// <returns>Data list</returns> private async Task <List <T> > QueryListAsync <T>(Region region, CancellationToken cancellationToken = default(CancellationToken)) { List <T> list = await _context.QueryDataDefineListAsync <T>(DataEntityMapping.GetEntityMapping(typeof(T)), _level, _command, region, null, null, cancellationToken); Callback(); return(list); }
/// <summary> /// Query and return first data /// </summary> /// <typeparam name="T">Data type.</typeparam> /// <param name="cancellationToken">CancellationToken.</param> /// <returns>First data</returns> public async Task <T> QueryFirstAsync <T>(CancellationToken cancellationToken = default(CancellationToken)) { T target = await _context.QueryDataDefineSingleAsync <T>(DataEntityMapping.GetEntityMapping(typeof(T)), _level, _command, 0, null, null, cancellationToken); Callback(); return(target); }
/// <summary> /// Query and return data enumerable /// </summary> /// <typeparam name="T">Data type.</typeparam> /// <param name="region">Data region</param> /// <returns>Data enumerable</returns> private IEnumerable <T> Query <T>(Region region) { IEnumerable <T> enumable = _context.QueryDataDefineReader <T>(DataEntityMapping.GetEntityMapping(typeof(T)), _level, _command, region, null, null); Callback(); return(enumable); }
/// <summary> /// Query and return data list /// </summary> /// <typeparam name="T">Data type.</typeparam> /// <param name="region">Query region</param> /// <returns>Data list</returns> private List <T> QueryList <T>(Region region) { List <T> list = _context.QueryDataDefineList <T>(DataEntityMapping.GetEntityMapping(typeof(T)), _level, _command, region, null, null); Callback(); return(list); }
public SingleParameterLambdaState(ParameterExpression parameter) { _singleEntityName = parameter.Name; var entityMapping = DataEntityMapping.GetEntityMapping(parameter.Type); _singleEntityMap = entityMapping.GetRelationMap(); }
public RelateParameterLambdaState(ParameterExpression parameter, LambdaState state) { var entityMapping = DataEntityMapping.GetEntityMapping(parameter.Type); _singleEntityName = parameter.Name; _singleEntityMap = entityMapping.GetRelationMap(); _state = state; }
public SingleParameterLambdaState(ParameterExpression parameter) { this.singleEntityName = parameter.Name; Type type = parameter.Type; DataEntityMapping entityMapping = DataEntityMapping.GetEntityMapping(type); this.singleEntityMap = entityMapping.GetRelationMap(); }
protected virtual void InitialRelateMappingInc() { DataEntityMapping mapping = DataEntityMapping.GetEntityMapping(this.relateType); DataFieldInfo [] infos = new DataFieldInfo [keyPairs.Length]; DataFieldMapping [] fields = new DataFieldMapping [keyPairs.Length]; for (int i = 0; i < this.keyPairs.Length; i++) { DataFieldMapping field = mapping.FindDataEntityField(keyPairs [i].RelateKey); if (field == null) { throw new LightDataException(string.Format(SR.CanNotFindTheSpecifiedField, mapping.ObjectType, keyPairs[i].RelateKey)); } fields [i] = field; infos [i] = new DataFieldInfo(field); } this.relateInfos = infos; this.relateFieldMappings = fields; this.relateEntityMapping = mapping; }
protected QueryBase(DataContext dataContext) { _context = dataContext; _mapping = DataEntityMapping.GetEntityMapping(typeof(T)); }
public override IAggregate <K> OrderByRandom() { _order = new RandomOrderExpression(DataEntityMapping.GetEntityMapping(typeof(T))); return(this); }
protected SelectBase(DataContext context, LambdaExpression expression, Type type) { _context = context; _expression = expression; Mapping = DataEntityMapping.GetEntityMapping(type); }
internal DataFieldInfo(Type type, string name) : this(DataEntityMapping.GetEntityMapping(type), false, name) { }