Reputation: 143
how can i get the data as my class design
public class Fsr
{
public string formId { get; set; }
public string formName { get; set; }
[PrimaryKey, AutoIncrement]
public int fId { get; set; }
public int resultId { get; set; }
}
public class Taskarray
{
[PrimaryKey, AutoIncrement]
public int taskId {get ;set;}
public int resultId { get; set; }
}
public class Result
{
[PrimaryKey, AutoIncrement]
public int resultId {get; set;}
public List<Taskarray> taskarray { get; set; }
public List<Fsr> fsr { get; set; }
public int rootId { get; set; }
}
I am using the below code to get
db is sqliteconntion string;
var data1 = (from e in db.Table<Result>()
from f in db.Table<Fsr>() where f.resultId == e.resultId
from t in db.Table<Taskarray>() where t.resultId == e.resultId
select new
{
e,
e.taskarray=t,
e.fsr=f
}).ToList();
please tell how i get this
Upvotes: 1
Views: 381
Reputation: 176936
Update : as query not reutrning list you can just use specific type without array
select new Tuple<Result, Taskarray, Fsr >
(
e,
t,
f
);
You can make use of tuple if you dont want to create new class fro mapping
select new Tuple<Result, List<Taskarray>, List<Fsr> >
(
e,
t.ToList<Taskarray>(),
f.ToList<Fsr>()
);
Find linq example at Tuple Type in C#4.0
you can try like this , you can create new class which handle the data coming
select new Myobject
{
e= e,
taskarray =t,
fsr =f
}
Upvotes: 1