Hello everyone, I'm trying to populate a grid with localized data.
My codefirst entity framework database look like this:
I want to show in my kendo grid Collection of Product with ProdLang properties for current user language (eg. Name, Description)
For doing that i buil a flattened class, like this:
My problem is that I want to let user to order & paging data, but I don't want to load entire collection everytime I have to display grid and pass it to "ToDataSourceResult" method.
There is a way for loading from the DB only the desired data?
Thanks
My codefirst entity framework database look like this:
public
class
Prod
{
public
int
ProdId {
get
;
set
; }
public
int
Quantity {
get
;
set
; }
//Other Properties & Navigation Properties
public
ICollection<ProdLang> ProdLangs {
get
;
set
; }
}
public
class
ProdLang
{
public
int
ProdLangId {
get
;
set
; }
public
int
LangId {
get
;
set
; }
public
string
Name {
get
;
set
; }
public
string
Description {
get
;
set
; }
//Other Properties
public
int
ProdId {
get
;
set
; }
public
Prod Prod {
get
;
set
; }
}
I want to show in my kendo grid Collection of Product with ProdLang properties for current user language (eg. Name, Description)
For doing that i buil a flattened class, like this:
public
class
ProdView
{
public
int
ProdId {
get
;
set
; }
public
int
Quantity {
get
;
set
; }
public
string
Name
{
get
{
return
ProdLangs.Single(pl => pl.LangId == langId).Name;
}
}
public
string
Description
{
get
{
return
ProdLangs.Single(pl => pl.LangId == langId).Description;
}
}
//Other Properties & Navigation Properties
public
ICollection<ProdLang> ProdLangs {
get
;
set
; }
}
My problem is that I want to let user to order & paging data, but I don't want to load entire collection everytime I have to display grid and pass it to "ToDataSourceResult" method.
There is a way for loading from the DB only the desired data?
Thanks