2014-01-15 70 views
0

我需要在接口中聲明方法的幫助。實施方法:方法的.NET MVC接口

public virtual IEnumerable<TEntity> Get(
     Expression<Func<TEntity, bool>> filter = null, 
     Func<IQueryable<TEntity>, IOrderedEnumerable<TEntity>> orderBy = null, 
     string includeProperties = "") 
    {... 
    } 

謝謝。

+1

你遇到什麼錯誤? –

+1

作爲**非常簡單的**經驗法則,刪除所有訪問修飾符('public','virtual'等)和實現(用';'替換'{...}')。剩下的是界面方法聲明... – Tallmaris

回答

3

這裏是你如何把它放在一個接口:

public interface IRepository 
{ 
    IEnumerable<TEntity> Get<TEntity>(Expression<Func<TEntity, bool>> filter = null, 
     Func<IQueryable<TEntity>, IOrderedEnumerable<TEntity>> orderBy = null, 
     string includeProperties = "") 
} 

public interface IRepository<TEntity> 
{ 
    IEnumerable<TEntity> Get(Expression<Func<TEntity, bool>> filter = null, 
     Func<IQueryable<TEntity>, IOrderedEnumerable<TEntity>> orderBy = null, 
     string includeProperties = "") 
} 
+0

第二個工程完美。謝謝!! – user1832330