I have bellow class :
public class KardeksKalaComplexColumnInfoM{
private decimal _Qty;
public decimal Qty
{
get { return _Qty; }
set
{
if (_Qty != value)
{
_Qty = value;
this.RaisePropertyChanged("Qty");
this.RaisePropertyChanged("Total");
}
}
}
private decimal _Fee;
public decimal Fee
{
get { return _Fee; }
set
{
if (_Fee != value)
{
_Fee = value;
this.RaisePropertyChanged("Fee");
this.RaisePropertyChanged("Total");
}
}
}
public decimal Total
{
get { return Qty * Fee; }
}
}
and a context contains buys and sales,i run bellow code and results commented in three last lines:
var q_buys = (
from
r_d in _db.BuyDetails
select new KardeksKalaDetailM()
{
ID = r_d.ID,
Date = r_d.Date,
in = new KardeksKalaComplexColumnInfoM() {Qty = r_d.Qty, Fee = r_d.Fee },
});
var q_sales = (
from
r_d in _db.SaleDetails
select new KardeksKalaDetailM()
{
ID = r_d.ID,
Date = r_d.Date,
in = new KardeksKalaComplexColumnInfoM() { Qty=0 , Fee=0 },
});
var q1=q_buys.ToList(); // Ok
var q2=q_sales.ToList(); // Ok
var result=q_buys.Concat(q_sales).ToList(); // Error
when I change the KardeksKalaComplexColumnInfoM filed types to double the last line's error solved but when them types are decimal it has bellow error:
An exception of type 'System.InvalidOperationException' occurred in EntityFramework.dll but was not handled in user code
Additional information: The specified cast from a materialized 'System.Int32' type to the 'System.Int64' type is not valid.
how can resolve last line problem?