I fixed some cases of the coalesce operator; what happens if you do
something like this instead:

Orcamento = new { Id = (estoque.Orcamento ?? new
Oncamento()).Id<http://estoque.orcamento.id/>
 }

2011/3/4 Daniel Hoisel <[email protected]>

> Hello everybody!
>
> I'm getting a error while executing this statement bellow which query
> a database using NH linq. The comented line throws the following
> error:
>
> {"Object reference not set to an instance of an object."}
>
>
>
>
> // CODE
>                dtoList = (from estoque in operacoesDeEstoque
>                           orderby estoque.Produto.Nome ascending ,
> estoque.DataMovimentacao descending
>                           select new
>                                      {
>                                          Id = estoque.Id,
>                                          DataMovimentacao =
> estoque.DataMovimentacao,
>                                          TipoMovimentacao =
> estoque.TipoMovimentacao,
>                                          Quantidade =
> estoque.Quantidade,
>                                          Valor = estoque.Valor,
>                                          Produto = new
>                                                        {
>                                                            Id =
> estoque.Produto.Id,
>                                                            Nome =
> estoque.Produto.Nome,
>                                                            Unidade =
> new {Sigla = estoque.Produto.Unidade.Sigla}
>                                                        },
>                  /*****************  Orcamento = estoque.Orcamento ==
> null ? null : new { Id = estoque.Orcamento.Id } *********/
>                                      });
>
>
>
> Somebody knows why? And how can I fix it? Is this statement supported
> by NH Linq provider?
> Thanks,
> Hoisel
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to