protected string PrintIncludes(CXXFileType fileType) { var sb = new StringBuilder(); Includes.ForEach(i => sb.AppendLine($"#incldue \"{i}\"")); sb.AppendEmptyLine(); return(sb.ToString()); }
public List <UserDTO> GetByCountry(string country) { var entity = new List <UserDTO>(); using (var entities = new TradingCompanyEntities()) { entity = _mapper.Map <List <UserDTO> >(entities.tblUsers.Where(user => user.tblAddresses.Any(x => x.Country == country)).FirstOrDefaultAsync().Result); if (Includes != null) { DbQuery <tblUser> query = entities.Set <tblUser>(); Includes.ForEach(x => query = query.Include(x)); } } if (entity == null) { throw new NullReferenceException(nameof(List <UserDTO>)); } return(entity); }
public UserDTO GetByNumber(string number) { var entity = new UserDTO(); using (var entities = new TradingCompanyEntities()) { entity = _mapper.Map <UserDTO>(entities.tblUsers.Where(user => user.PhoneNumber == number).FirstOrDefaultAsync().Result); if (Includes != null) { DbQuery <tblUser> query = entities.Set <tblUser>(); Includes.ForEach(x => query = query.Include(x)); } } if (entity == null) { throw new NullReferenceException(nameof(UserDTO)); } return(entity); }
protected virtual List <IncludeDirective> GetMemberIncludes(MemberExpression memberExp) { var newIncludes = new List <IncludeDirective>(); var memberIsNotCollection = !TypesUtil.IsNonPrimitiveCollection(memberExp.Type); Includes.ForEach(inc => { var includeExpression = inc.GetSelector().Body as MemberExpression; if (memberIsNotCollection) { var innermostMember = ExpressionUtil.GetInnermostMemberExpression(includeExpression); if (innermostMember.Member == memberExp.Member && includeExpression.Expression is MemberExpression) { var slicedExpression = ExpressionUtil.ReplaceInnermostMemberExpressionWithParameter(includeExpression) as MemberExpression; if (inc is IIncludeInCollectionDirective) { newIncludes.Add(IncludeDirectiveUtil.GetIncludeInCollectionDirective(slicedExpression, (inc as IIncludeInCollectionDirective).GetFieldSelector())); } else { newIncludes.Add(IncludeDirectiveUtil.GetIncludeDirective(slicedExpression)); } } } else { if (inc is IIncludeInCollectionDirective && ExpressionUtil.IsEquivalent(inc.GetSelector().Body, memberExp)) { newIncludes.Add(IncludeDirectiveUtil.GetIncludeDirective ((inc as IIncludeInCollectionDirective).GetFieldSelector())); } } }); return(newIncludes); }
protected override void WriteElements(XmlWriter writer) { base.WriteElements(writer); Includes.ForEach(x => x.Write(writer)); Items.ForEach(x => x.Write(writer)); }