解决方案 »

  1.   

    你先看看 typeof(accessdal.SqlHelperX<T>).FullName 是什么样子的,再和你拼接的字符串比对下
      

  2.   

    这个我知道可以行,但他的字符串是这样子的:accessdal.SqlHelperX`1[[Model.GoodsCategory, Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]
    因为他是泛型,且带版本号,会不会有不确定?
      

  3.   

    这个我知道可以行,但他的字符串是这样子的:accessdal.SqlHelperX`1[[Model.GoodsCategory, Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]
    因为他是泛型,且带版本号,会不会有不确定?
    你可以用 typeof(T).AssemblyQualifiedName 代替FullName参与拼接
      

  4.   

    Type.MakeGenericType
    http://msdn.microsoft.com/zh-cn/library/system.type.makegenerictype.aspx
      

  5.   

    泛型实例化,楼主参考:
            public static ISqlHelperX<T> CreateSqlHelperX<T>()
                   where T : new()
            {
                Assembly a = Assembly.Load(path);
                Type t = a.GetType((path +".SqlHelperX`1");
                Type[] typeArgs = { typeof(T) };
                Type constructed = t.MakeGenericType(typeArgs);
                return (ISqlHelperX<T>)System.Activator.CreateInstance(constructed);
            }