using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using IDAL;
namespace DALFactory
{
/// <summary>
/// Abstract Factory class pattern to create the DAL implementation
/// </summary>
public class DBAccess
{
//look up the DAL implementation we should be using
private static readonly string path = "SqlServerDAL";
/// <summary>
/// Default constructor
/// </summary>
public DBAccess() { }
public static IUser CreateUser()
{
string classname = path + ".User";
return (IUser)Assembly.Load(path).CreateInstance(classname);
}
}
}
其中SqlServerDAL为具体实现。但是为什么出现这样的错误“Could not load file or assembly 'SqlServerDAL' or one of its dependencies. The system cannot find the file specified. ”