2012-06-05 59 views
0

我不知道是怎麼回事..智能感知不工作 - 無論是與總結標籤

我做的EntityFramework上下文的信息庫通用模式接口,和我的接口只包含5種方法。

-Query - 插入 -Delete -Synchronize -Dispose

我在摘要部分寫的文件,但是當我使用這個類中,智能感知好好嘗試一下顯示任何信息,所以我儘量感動總結到一個接口,這個類實現了這個接口,但不起作用。

這裏是類和接口

public interface IRepositorySource : IDisposable 
{ 
    /// <summary> 
    ///  Allow Queries with LINQ to Entities throught IQueryable interface 
    /// </summary> 
    /// <typeparam name="T"></typeparam> 
    /// <returns>Teste</returns> 
    IQueryable<T> Query<T>() where T : class; 

    /// <summary> 
    ///  Insert the e object in specific table. 
    ///  The inserted object is only on database after Synchronize was called. 
    /// </summary> 
    /// <typeparam name="T"></typeparam> 
    /// <param name="e"></param> 
    void Insert<T>(T e) where T : class; 

    /// <summary> 
    ///  Delete the e object from specific table. 
    ///  The deleted object is only removed from database after Synchronize was called. 
    /// </summary> 
    /// <typeparam name="T"></typeparam> 
    /// <param name="e"></param> 
    void Delete<T>(T e) where T : class; 

    /// <summary> 
    ///  Synchronize the database with all pending operations. 
    /// </summary> 
    void Synchronize(); 

    /// <summary> 
    ///  Free all managed resources such the connection and ObjectContext associated with the repository 
    /// </summary> 
    void Dispose(); 
} 





/// <summary> 
///  By inherit from this class, you get the Repository Patter to query the datasource. 
/// </summary> 
public class RepositoryBase : IRepositorySource, IDisposable 
{ 
    readonly ObjectContext m_context; 


    public RepositoryBase(ObjectContext context) 
    { 
     if (context == null) 
      throw new ArgumentNullException("context"); 

     m_context = context; 
    } 


    ObjectSet<T> Table<T>() where T : class { 

     // 
     // As the entity framework creates the properties with the same name of the Type we want to access, 
     // it is really easy to map those types to properties throught reflection 
     // Get the property of the context with the name of the type. 
     // 

     return (ObjectSet<T>) m_context.GetType().GetProperty(typeof(T).Name).GetValue(m_context, null); 
    } 


    public IQueryable<T> Query<T>() where T : class { 
     return Table<T>(); 
    } 


    public void Insert<T>(T e) where T : class { 
     Table<T>().AddObject(e); 
    } 


    public void Delete<T>(T e) where T : class { 
     Table<T>().DeleteObject(e); 
    } 


    public void Synchronize() { 
     m_context.SaveChanges(); 
    } 

    public void Dispose() { 
     m_context.Dispose(); 
    } 
} 

你知道什麼是可能發生的事情?

回答

2

我找到的解決方案是通過Visual Studio,點擊Class Library Project,Properties,Build,XML文檔文件進行檢查。