全部選擇我的這個選擇所有城市:與Lambda和EF
ExecuteStoreCommand<MCT_DBEntities>("select * from cities", ConnectionResolver.DB_Connection);
現在我試圖將轉換爲LAMBDA,但我怎麼告訴它SELECT *
?
GetWithExpression<city, MCT_DBEntities>(u => u.SelectMany, ConnectionResolver.DB_Connection);
編輯:
private static TValue RetryGetWithExpression<U,T, TValue>(Func<ObjectSet<T>, TValue> func, String connection, Int32 retryInfiniteLoopGuard = 0)
where T : class
where U : ObjectContext
{
Microsoft.Practices.TransientFaultHandling.RetryPolicy policy = RetryPolicyProvider.GetSqlAzureRetryPolicy();
using (U entitiesContext = (U)Activator.CreateInstance(typeof(U), new[] { connection }))
{...}
這是我的函數功能:函數,T> FUNC –
user1662812
@ user1662812所以這是選擇?那麼'x => x'怎麼樣? – 2kay
無法將lambda表達式轉換爲委託類型'System.Func,DataAccessComponents.EntityDataModels.city>' –
user1662812