F
Fett
Problem: My member variables in the child class are always null. I
don't know why this happens!
I have a base class for handling a user flow in my web, CWebUseCase,
the class is declared like: public class CWebUseCase {...};
This class is inherited into several specific flows like this one
CXmlFileList, which I will use to present a simple list to the user.
//CXmlFileList declaration:
public class CXmlFileList : CWebUseCase, IWebUseCase
{
private string strTest = "Test string";
public void testFunction()
{
// This Assert fails!!!!
Debug.Assert(strTest!=null);
strTest = "Hello";
// This Assert also fails ?????
Debug.Assert(strTest!=null);
}
}
The class is instanciated dynamically and the assembly in which the
class resides is also loaded dynamically:
/* Other class which calls the use cases */
// Load the assembly
assembly = Assembly.LoadFile(strAssemblyPath);
// Instanciate the class and cast the type to the implemented interface
uc = (IWebUseCase) assembly.CreateInstance("MyNamepace.CXmlFileList");
// Cast the interface to the base class
m_uc = (CWebUseCase)uc;
// Call the test function
m_uc.testFunction();
Why doesn't the member variable take any values? Does it have anything
todo with the dynamic creation?
Please help me, this "feature" affects an otherwise quit good design of
our application.
Thanks!/Peter
don't know why this happens!
I have a base class for handling a user flow in my web, CWebUseCase,
the class is declared like: public class CWebUseCase {...};
This class is inherited into several specific flows like this one
CXmlFileList, which I will use to present a simple list to the user.
//CXmlFileList declaration:
public class CXmlFileList : CWebUseCase, IWebUseCase
{
private string strTest = "Test string";
public void testFunction()
{
// This Assert fails!!!!
Debug.Assert(strTest!=null);
strTest = "Hello";
// This Assert also fails ?????
Debug.Assert(strTest!=null);
}
}
The class is instanciated dynamically and the assembly in which the
class resides is also loaded dynamically:
/* Other class which calls the use cases */
// Load the assembly
assembly = Assembly.LoadFile(strAssemblyPath);
// Instanciate the class and cast the type to the implemented interface
uc = (IWebUseCase) assembly.CreateInstance("MyNamepace.CXmlFileList");
// Cast the interface to the base class
m_uc = (CWebUseCase)uc;
// Call the test function
m_uc.testFunction();
Why doesn't the member variable take any values? Does it have anything
todo with the dynamic creation?
Please help me, this "feature" affects an otherwise quit good design of
our application.
Thanks!/Peter