i have a c# win application and i would use navigation properties of linq only for some conditiones are applied.
for example i have this class
public class t020
{
public decimal ID_CLIENTE { get; set; }
public Nullable<decimal> ID_COMUNE { get; set; }
public Nullable<decimal> ID_CONSORZIO { get; set; }
}
with this navigation properties
public partial class T232
{
public decimal ID_CLIENTE_CONTO { get; set; }
public Nullable<decimal> ID_SISTEMA { get; set; }
public decimal ID_CLIENTE { get; set; }
}
public partial class T234
{
public decimal ID_CONTO { get; set; }
public decimal ID_CLIENTE { get; set; }
}
i would use include of T232 and of t234 only some condition are applied for example using this variables:
string MyString =null
decimal MyDecimal =8
and so i would using include only when Mystring is not null to use Include of t232
and only when mydecimal =8 to use include of y234
i would have a query like this
using (var cont = DALProvider.CreateEntityContext())
{
var result = from da in dalProv.Include(i => i.T232 where MyString!=null)
.Include(i => i.T23d where MyDecimal==8)
select da
}
and so on but in this way linq gives me error.
how can i do this in linq?
thanks a lot