public EntityInfo(EntityModule module, Type entityType, EntityKind kind = EntityKind.Table, EntityArea altArea = null) { Module = module; EntityType = entityType; Area = altArea ?? Module.Area; Kind = kind; Name = entityType.Name; Members = new List <EntityMemberInfo>(); Events = new EntityEvents(); //Check for generic types - happens in modules with generic entities (interfaces), provided for customization if (Name.Contains('`')) { Name = Name.Substring(0, Name.IndexOf('`')); } if (EntityType.IsInterface && Name.Length > 1 && Name.StartsWith("I")) { Name = Name.Substring(1); } FullName = Area.Name + "." + Name; EntitySetConstant = ExpressionMaker.MakeEntitySetConstant(this.EntityType); }
public OperationResult <IList <AccountDTO> > Read(AccountFilter filter = null) { Expression <Func <IQueryable <Account>, IOrderedQueryable <Account> > > expressionOrderByAccount = null; Expression <Func <Account, bool> > expressionWhereAccount = new ExpressionMaker().GetExpressionWhere <Account, AccountDTO>(filter, _mapper); if (filter?.Sort != null) { expressionOrderByAccount = source => source.OrderBy(string.Join(",", filter.Sort.Select(item => item.GetSortCriteria()))); } IList <Account> result = null; if (filter?.Paging != null) { result = _db.GetRepository <Account>().GetPagedList(expressionWhereAccount, expressionOrderByAccount?.Compile(), pageIndex: (int)filter?.Paging?.Page, pageSize: (int)filter?.Paging?.PageItems).Items; } else { result = _db.GetRepository <Account>().GetPagedList(expressionWhereAccount, expressionOrderByAccount?.Compile()).Items; } return(OperationResult <IList <AccountDTO> > .Success(_mapper.Map <IList <AccountDTO> >(result))); }
static BinaryExpression MutateBinary(BinaryExpression node, IList <Expression> operands) { // After replacing arguments with column expressions there might be a problem with nullable columns. // The following code compensates for this return(ExpressionMaker.MakeBinary(node.NodeType, operands[0], operands[1])); }