kgrzybek / modular-monolith-with-ddd

Full Modular Monolith application with Domain-Driven Design approach.
MIT License
10.89k stars 1.71k forks source link

How to query data with where clause including ValueObject,please? #238

Open effapp opened 2 years ago

effapp commented 2 years ago

How to query data with where clause including ValueObject,please?

like this: dbContext.Set().Where(o=>o.TotalAmount.Value >50000).ToList();

but it throw exception.

TotalAmount is the ValueObject of { Value, Currency}.

effapp commented 2 years ago

How to solve this issue, please?

effapp commented 2 years ago

How to query data with where clause including ValueObject,please? public class Customer { public int CustomerID { get; set; } public string Name { get; set; } public Boolean IsActive { get; set; } public MoneyValueObject Balance { get; set; } }

public class MoneyValueObject { public float Amount { get; set; } public string Currency { get; set; } }

var customers=dbContext.Set().Where(o=>o.Banlance.Amount >50000).ToList(); but it throw exception.