I have the following method below for the purpose of returning notifications that should be displayed for a given client and notifications that should be served to all clients.
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);
}
However, the return notificacoesAll.Union(notificacoesClient);
statement is returning the following message:
Can not implicity convert type 'System.Collections.Generic.IEnumerable' to 'System.Collections.Generic.List'. An explicit conversion exists (are you missing a cast?)
How could you resolve this issue?