LINQ to Entities does not recognize the method Int32 method in static class.

solve Entities doesnt recognize method Int32 method in class حل مشكلة

solve Entities doesnt recognize method Int32  method in class حل مشكلة

في تقنية برمجة المواقع بال mvc and ,mvc core

عادة مانستخدم كلاس class1 ونضع فيه قيمة مثلا 5 بميثود مثلا نسميها id

ثم نستدعي الكلاس هذا في جملة انتيتي فرام ورك مثلا

var myVar= Entity.table.Where(c => c.id == class1.id())

هنا تتفاجأ برسالة خطأ هذه

LINQ to Entities does not recognize the method Int32 method in static class

LINQ to Entities does not recognize the method Int32 method in static class.

الحل ببساطة Solution is

ان تستدعي الكلاس اولا في قيمة 

int id=class1.id

var myVar= Entity.table.Where(c => c.id ==id)

وستعمل معك 

 

نشكرك علي المشاركة