SORU
30 Ocak 2013, ÇARŞAMBA


Varlıklar 'Tarih' SERİ desteklenmiyor belirtilen tip üyesi. Sadece başlatıcılar, tüzel kişiler ve varlık navigasyon özellikleri

Bu kodu kullanarakVarlık ÇerçevesiAşağıdaki hatayı alıyorum. Belirli bir tarih, DateTimeStart Bu biçimde yazın Türü 2013-01-30 12:00:00.000 tüm satırları almak istiyorum

Herhangi bir fikir?

 var eventsCustom = eventCustomRepository.FindAllEventsCustomByUniqueStudentReference(userDevice.UniqueStudentReference)
                    .Where(x =>  x.DateTimeStart.Date == currentDateTime.Date);

Ve hata

base {System.SystemException} = {"The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported."}

CEVAP
30 Ocak 2013, ÇARŞAMBA


DateTime.Date SQL dönüştürülemez. EntityFunctions.TruncateTime yöntem tarih bölümü kullanın.

var eventsCustom = eventCustomRepository.FindAllEventsCustomByUniqueStudentReference(userDevice.UniqueStudentReference)
   .Where(x => EntityFunctions.TruncateTime(x.DateTimeStart) == currentDate.Date);

@Varlık içinde 6 EntityFunctions Çerçeve kullanılmıyor ve Varlık Çerçevesi ile birlikte gelen DbFunctions sınıf, kullanmalısınız. yorumlarda bahsedilen shankbond Olarak GÜNCELLEYİN:

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • Louis C.K.

    Louis C.K.

    18 HAZİRAN 2006
  • Blu animations and other videos

    Blu animatio

    15 HAZİRAN 2007
  • Xcode programming tutorials

    Xcode progra

    17 EYLÜL 2006