Uploaded image for project: 'Spring.NET'
  1. Spring.NET
  2. SPRNET-517

Factory method IoC instantiation is not finding correct overloaded method.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.1 P3
    • Fix Version/s: 1.1 M2
    • Component/s: Spring-NET-CORE
    • Labels:
      None

      Description

      See forum post http://forum.springframework.net/showthread.php?p=6417 by user 'Great'

      <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>

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mark.pollack Mark Pollack
              Reporter:
              mark.pollack Mark Pollack
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: