मैंने इस कोड को LINQ से SQL के साथ काम करते देखा था लेकिन जब मैं Entity फ्रेमवर्क का उपयोग करता हूं, तो यह इस त्रुटि को फेंकता है:
LINQ से एंटिटीज़ विधि '' System.Linq.IQueryable'1 [MyProject.Models.CommunityFeatures] GetCommunityFeatures () 'विधि को नहीं पहचानता है, और इस पद्धति को स्टोर अभिव्यक्ति में अनुवादित नहीं किया जा सकता है।
रिपॉजिटरी कोड यह है:
public IQueryable<Models.Estate> GetEstates()
{
return from e in entity.Estates
let AllCommFeat = GetCommunityFeatures()
let AllHomeFeat = GetHomeFeatures()
select new Models.Estate
{
EstateId = e.EstateId,
AllHomeFeatures = new LazyList<HomeFeatures>(AllHomeFeat),
AllCommunityFeatures = new LazyList<CommunityFeatures>(AllCommFeat)
};
}
public IQueryable<Models.CommunityFeatures> GetCommunityFeatures()
{
return from f in entity.CommunityFeatures
select new CommunityFeatures
{
Name = f.CommunityFeature1,
CommunityFeatureId = f.CommunityFeatureId
};
}
public IQueryable<Models.HomeFeatures> GetHomeFeatures()
{
return from f in entity.HomeFeatures
select new HomeFeatures()
{
Name = f.HomeFeature1,
HomeFeatureId = f.HomeFeatureId
};
}
LazyList is a List that extends the power of IQueryable.
Could someone explain why this error occurs?