मैं एक LINQ क्वेरी मुकदमा लैम्ब्डा भाव में ToShortDateString कॉल करने की आवश्यकता:linq lambda अभिव्यक्ति में ToShortDateString का उपयोग कैसे करें?
toRet.Notification = Repositories
.portalDb.portal_notifications.OrderByDescending(p => p.id)
.FirstOrDefault(p => p.date.ToShortDateString() == shortDateString);
लेकिन मैं त्रुटि मिलती है:
An exception of type 'System.NotSupportedException' occurred in System.Data.Entity.dll but was not handled in user code
Additional information: LINQ to Entities does not recognize the method 'System.String ToShortDateString()' method, and this method cannot be translated into a store expression.
मैं क्या कर सकते हैं, यह देखते हुए कि मैं ToShortDateString()
उपयोग करने के लिए की जरूरत है?
धन्यवाद।
इस थ्रेड में सहायता कर सकते हैं: http://stackoverflow.com/questions/5370402/entity-framework-4-linq-how-to-convert-from- डेटाटाइम-टू-स्ट्रिंग-इन-ए-क्वेरी –
इस थ्रेड को मदद करनी चाहिए: http://stackoverflow.com/questions/18233495/linq-to-entities-does-not-recognize-the-method-system-string- टोस्टिंग-विधि –