public class DataAccess<T>
{
protected static readonly string _path = ConfigurationSettings.AppSettings["WebDAL"];
public static IDAL.ITreeTable<T> CreatTreeTable(string tableName, string idName, string parentIdName, string displayOrderName)
{
if (string.IsNullOrEmpty(tableName) || string.IsNullOrEmpty(idName) || string.IsNullOrEmpty(parentIdName))
throw new Exception("tableName,idName,parentIdName,displayOrder必须设置.");
string className = _path + ".TreeTable`1[[" + typeof(T).FullName + "," + typeof(T).Assembly.ToString() + "]]";
Assembly assembly = Assembly.Load(_path);
Type t = assembly.GetType(className);
object[] args = new object[4];
args[0] = tableName;
args[1] = idName;
args[2] = parentIdName;
args[3] = displayOrderName;
return (IDAL.ITreeTable<T>)Activator.CreateInstance(t, args);
}
}