本帖最后由 lengxiezi 于 2010-10-02 15:47:47 编辑

解决方案 »

  1.   

    public interface IBaseDAL<T> where T : BaseModel, new()
    {
    }
    public static IDAL GetDAL(string name)
        {
            switch (name)
            {
                case "": return new ADAL(); break;
                case "": return new BDAL(); break;
                    ......
            }
        }
      

  2.   

    string defintion = "DAL.EF.ArticleProvider,DAL.EF";这样的话, 在web.config里定义
     <configSections>
      <section name="ArticleProvider" type="DAL.EF.ArticleProvider,DAL.EF"/>
      </configSections>
    可以动态在web.config里自定义需要实例化的类不就可以了么
      

  3.   

    调用时你得写这类代码:IArticleRepository ar = RepositoryCreater.CreatePepository<sp1234>();
      

  4.   

    可能是:  sp1234 == DAL.EF
      

  5.   

    哦不,可能是sp1234 == DAL.EF.ArticleProvider或者(加入并没有引用那个assembly的话)sp1234  == IArticleRepository 
      

  6.   

    public class Test<T>
        {}
    Test<string> t=new new Test<string>("1");