none
Unable to create a constant value of type ''. Only primitive types or enumeration types are supported in this context. RRS feed

  • Pergunta

  • Ola,

    estou com o seguinte problema,

    possuo uma lista de linguagens e o contexto do bd.

    preciso carregas na entidade search na propriedade language uma lista de linguas, usando subquerys.

    segue o codigo

    
    
     (from s in db.Search
                                                         let lan = langList
                                                         //join l in db.Language on s.LanguageId equals l.Id
                                                         join u in db.User on s.UserId equals u.Id
                                                         where u.Id == (UserId == Guid.Empty ? u.Id : UserId)
                                                               && s.isActive == true
                                                               && s.SearchId == SearchId
                                                         select new userModel.Search()
                                                         {
                                                             Id = s.Id,
                                                             SearchId = s.SearchId,
                                                             Title = s.Title,
                                                             Expression = s.Expression,
                                                             NotifyUser = s.NotifyUser,
                                                             isActive = s.isActive,
                                                             CreatedAt = s.CreatedAt,
                                                             UpdatedAt = s.UpdatedAt,
                                                             DeletedAt = s.DeletedAt,
                                                             Language = (from l in lan
                                                                         join sl in db.Search on l.Id equals sl.LanguageId
                                                                         where (sl.Id.Equals(s.Id) || sl.SearchId.Equals(s.SearchId)) && sl.isActive == true
                                                                         select new userModel.Language
                                                                         {
                                                                             Id = l.Id,
                                                                             Name = l.Name,
                                                                             Code = l.Code,
                                                                             //isPrimary = l.isPrimary,
                                                                             isActive = l.isActive,
                                                                             CreatedAt = l.CreatedAt,
                                                                             UpdatedAt = l.UpdatedAt,
                                                                             DeletedAt = l.DeletedAt
                                                                         }).ToList(),
                                                             User = new userModel.User()
                                                             {
                                                                 Id = u.Id,
                                                                 Name = u.Name,
                                                                 Email = u.Email,
                                                                 Gender = (u.Gender == null ? userEnumerator.Gender.None : (userEnumerator.Gender)u.Gender),
                                                                 Birthday = u.Birthday,
                                                                 isVerified = u.isVerified,
                                                                 VerifiedAt = u.VerifiedAt,
                                                                 VerifyToken = u.VerifyToken,
                                                                 isActive = u.isActive,
                                                                 CreatedAt = u.CreatedAt,
                                                                 UpdatedAt = u.UpdatedAt,
                                                                 DeletedAt = u.DeletedAt
                                                             }
                                                         }).ToList();
    

    se eu comento o language = "subquery" o codigo funciona.

    Alguma sugestão do que eu possa estar fazendo errado?


    Caso a resposta seja útil ou responda sua questão, colabore marcando-a como resposta ou como útil.

    quarta-feira, 12 de agosto de 2015 18:18