Great
09-15-2006, 05:42 PM
I am trying to use the GetObject method of the XmlObjectFactory class, but I am having an issue with it resolving the correct constructor.
function object Getobject(string objectId, IDataRecord dr)
{
XmlObjectFactory factory = new XmlObjectFactory(new FileSystemResource("C:\\somepath\\config.xml"), false);
object[] args = { dr };
return factory.GetObject(objectId, args);
}
This method is being called using a SQLDataReader.
My constructors look like this.
public Object(DataRow dr) : base(dr)
{
}
public Object(IDataRecord dr) : base(dr)
{
}
public Object()
{
}
Instead of the constructor having with the IDataRecord being resolved, the empty constructor is resolved.
I would expect the IDataRecord constructor to be used since SQLDataReader implements IDataRecord.
Please give me some insight to what needs to be done to resolve the IDataRecord constructor.
function object Getobject(string objectId, IDataRecord dr)
{
XmlObjectFactory factory = new XmlObjectFactory(new FileSystemResource("C:\\somepath\\config.xml"), false);
object[] args = { dr };
return factory.GetObject(objectId, args);
}
This method is being called using a SQLDataReader.
My constructors look like this.
public Object(DataRow dr) : base(dr)
{
}
public Object(IDataRecord dr) : base(dr)
{
}
public Object()
{
}
Instead of the constructor having with the IDataRecord being resolved, the empty constructor is resolved.
I would expect the IDataRecord constructor to be used since SQLDataReader implements IDataRecord.
Please give me some insight to what needs to be done to resolve the IDataRecord constructor.