Ne arayalım?

ARAMIZA KATILIN

BİZE ULAŞIN

Adres:

E-posta:

host/bin/bilisimlife.dll

iletisim@bilisimlife.net




 
Rserit
Developer
       
 1026  
 278

Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery, DbRawSqlQuery) is not supported hatası ve çözümü

Selamlar,
Entity Framework'te bir sorgu yazdıysanız ve "Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery, DbRawSqlQuery) is not supported" gibi bir hata alıyorsanız sebebi bir metod eksikliğinden kaynaklanıyor.

Şöyle bir sorgu yazdım diyelim:



                    var menulist = from t in ote.ProductType
                                    join m in ote.Menu on t.ID equals m.TypeID
                                    orderby (m.Product)
                                    select new
                                    {
                                        TypeName = t.TypeName,
                                        Price = m.Price,
                                        Product = m.Product,
                                        FilterName = t.FilterName,
                                        PicturePath = t.PicturePath,
                                        PicturePathMenu = m.PicturePathMenu,
                                        SubDesc = m.Subdesc
                                    };



Yukarıdaki kod hata verecektir. Çünkü ToList gibi bir metod kullanmadım.

Doğrusu şöyle:



                    var menulist = (from t in ote.ProductType
                                    join m in ote.Menu on t.ID equals m.TypeID
                                    orderby (m.Product)
                                    select new
                                    {
                                        TypeName = t.TypeName,
                                        Price = m.Price,
                                        Product = m.Product,
                                        FilterName = t.FilterName,
                                        PicturePath = t.PicturePath,
                                        PicturePathMenu = m.PicturePathMenu,
                                        SubDesc = m.Subdesc
                                    }).ToList();


Kolay gelsin,
Recep.

Developer.


 
Rserit
Developer
       
 1026  
 278

DataBinding öncesi sorguyu çalıştırmak için zorlamalısınız. ToList() metodu kullanımı sorguyu çalıştırmaya zorlar.

Developer.