मैं Ladislav Mrnka की सलाह here उपयोग करने के लिए उपयोग करने के लिए कोशिश कर रहा हूँ:Ladislav Mrnka की सलाह को शामिल करें
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using System.Data.Entity;
namespace SimTask.Data.EF4
{
public static class Extensions
{
public static IQueryable<T> IncludeMultiple<T>(this IQueryable<T> query,
params Expression<Func<T, object>>[] includes)
where T : class
{
if (includes != null)
{
query = includes.Aggregate(query,
(current, include) => current.Include(include));
}
return query;
}
}
}
लेकिन मैं कोई त्रुटि मिलती है। संकलक current.Include
को नहीं पहचानता है:
Error 7 'System.Linq.IQueryable<T>' does not contain a definition for 'Include' and no extension method 'Include' accepting a first argument of type 'System.Linq.IQueryable<T>' could be found (are you missing a using directive or an assembly reference?) C:\MySolution\MyProj.Data.EF4\Extensions.cs 19 57 MyProj.Data.EF4
मैं here से ADO.NET इकाई की रूपरेखा 4.1 स्थापित किया।
इससे मदद नहीं मिलती है। मैंने अपना प्रश्न अपडेट किया। – Naor
@Naor: क्या आपने अपनी परियोजना में EntityFramework का संदर्भ जोड़ा था? – BrokenGlass
मेरे पास System.Data.Entity का संदर्भ है। क्या यह इकाई ढांचे का प्रतिनिधित्व नहीं करता है? – Naor