Great
02-20-2007, 03:04 PM
First off I am using Spring.NET 1.1 Preview 3 and .net 2.0
My configuration looks like this:
<object id="Location" type="MyStuff.Location, MyStuff" singleton="false"
factory-object="LocationFactory" factory-method="CreateInstance"></object>
<object id="LocationFactory" type ="MyStuff.Factory.LocationFactory, MyStuff"
abstract="false" singleton="true"></object>
My LocationFactory looks like this.
public class LocationFactory
{
public Location CreateInstance()
{
return new Location();
}
public Location CreateInstance(DataRow dr)
{
return new Location(dr);
}
public Location CreateInstance(IDataRecord dr)
{
return new Location(dr);
}
}
My issue is when I "GetObject" using the AbstractObjectFactory with a SqlDataReader as my argument, it tries to match it with the DataRow Overload when it should match the IDataRecord overload. The DataRow overload is matching correctly only because it is first. Please take a look at the Spring.Objects.Factory.Support.AbstractAutoWireCap ableObjectFactory class in the method InstantiateUsingFactoryMethod(string name, RootObjectDefinition definition, object[] arguments). I believe for some reason the correct overload is not being matched here. And remember I am using 2.0.
My configuration looks like this:
<object id="Location" type="MyStuff.Location, MyStuff" singleton="false"
factory-object="LocationFactory" factory-method="CreateInstance"></object>
<object id="LocationFactory" type ="MyStuff.Factory.LocationFactory, MyStuff"
abstract="false" singleton="true"></object>
My LocationFactory looks like this.
public class LocationFactory
{
public Location CreateInstance()
{
return new Location();
}
public Location CreateInstance(DataRow dr)
{
return new Location(dr);
}
public Location CreateInstance(IDataRecord dr)
{
return new Location(dr);
}
}
My issue is when I "GetObject" using the AbstractObjectFactory with a SqlDataReader as my argument, it tries to match it with the DataRow Overload when it should match the IDataRecord overload. The DataRow overload is matching correctly only because it is first. Please take a look at the Spring.Objects.Factory.Support.AbstractAutoWireCap ableObjectFactory class in the method InstantiateUsingFactoryMethod(string name, RootObjectDefinition definition, object[] arguments). I believe for some reason the correct overload is not being matched here. And remember I am using 2.0.