Possuo o seguinte método abaixo com o propósito de retornar notificações que devem ser exibidas para determinado cliente e notificações que devem ser exibidas para todos os clientes.
public List<TNotification> GetNotifications(TClient client)
{
var notificacoesClient = Session.CreateCriteria<TNotification>()
.CreateAlias("TClientNotifications", "clientNotifications", JoinType.LeftOuterJoin)
.SetFetchMode("clientNotifications.Client", FetchMode.Eager)
.CreateAlias("clientNotifications.Client", "client", JoinType.LeftOuterJoin)
.Add(Restrictions.Eq("client.Id", client.Id))
.AddOrder(Order.Desc("Id"))
.List<TNotification>()
.ToList();
var notificacoesAll = Session.CreateCriteria<TNotification>()
.Add(Restrictions.Eq("IsToAll", true))
.AddOrder(Order.Desc("Id"))
.List<TNotification>()
.ToList();
return notificacoesAll.Union(notificacoesClient);
}
Porém na instrução return notificacoesAll.Union(notificacoesClient);
está retornando a seguinte mensagem:
Cannot implicity convert type 'System.Collections.Generic.IEnumerable' to 'System.Collections.Generic.List'. An explicit conversion exists (are you missing a cast?)
Como poderia resolver esta questão?