I have a VSTO Word Addin project which integrates with the Word 2007, when I click on login button on my Addin, I execute the following method:
private void btnOK_Click(object sender, System.EventArgs e)
{
AuditDataAccess auditDataAccess =
(AuditDataAccess)DataAccessFactory.GetNewInstance(typeof(AuditDataAccess));
}
Here, DataAccessFactory
is a class in another referenced assembly named RemoteData
as follows:
public class DataAccessFactory
{
static DataAccessFactory()
{
objADDataAccess = new ADDataAccess();
}
}
Here, ADDataAccess
is a class in the same assembly RemoteData
as:
namespace RemoteData.Client
{
public class ADDataAccess : IDataAccess
{
RemoteData.Server.ADDataAccess proxy = null;
internal ADDataAccess()
{
proxy = new RemoteData.Server.ADDataAccess(); // Error Line
}
}
public interface IDataAccess
{
bool IsActive
{
get;
}
}
}
Server.ADDataAccess
is in the same assembly RemoteData
as:
namespace RemoteData.Server
{
public class ADDataAccess:DataAccess
{
DataAccess.ADDataAccess objDataAccess;
public ADDataAccess()
{
//objDataAccess = new DataAccess.ADDataAccess();
}
}
public abstract class DataAccess : MarshalByRefObject
{
public bool IsActive
{
get { return true; }
}
}
}
I have commented the code for new DataAccess.ADDataAccess()
which is creating a new object of a class in another reference assembly named DataAccess
, thinking that this might be the one creating the problem, but I am still receiving the same error mentioned in the question header on the line commented as Error Line
EDIT
: I have created a small project with the same architecture and it is working fine. Here is the download link: http://www.2shared.com/file/dGXNtsAK/Server.html
Please please help...