I have had minimal exposure to IoC and am using LinFu. The main problem I am having is that errors are not being picked up until run-time. I much prefer to deal with compile time errors.
For example, if I create an object using the following code:
return ServiceContainer.GetService(typeof(IPurchaseOrder), tPO.IntPOId,
tPO.CustPONumber, custFac, tPO.FulfilledDate) as IPurchaseOrder;
The object I have created to implement this interface is:
[Implements(typeof(IPurchaseOrder), LifecycleType.OncePerRequest)]
public class PurchaseOrderImpl : IPurchaseOrder
{
public PurchaseOrderImpl(int intPOID, string customerPONumber, ICustomerFacility custFacility, DateTime? fulFilledDate )
{
IntPOID = intPOID;
CustomerPONumber = customerPONumber;
CustomerFacility = custFacility;
FulFilledDate = fulFilledDate;
}
..........
Let's say I now want to add another parameter to the constructor:
[Implements(typeof(IPurchaseOrder), LifecycleType.OncePerRequest)]
public class PurchaseOrderImpl : IPurchaseOrder
{
public PurchaseOrderImpl(int intPOID, string customerPONumber, ICustomerFacility custFacility, DateTime? fulFilledDate, double commision )
{
IntPOID = intPOID;
CustomerPONumber = customerPONumber;
CustomerFacility = custFacility;
FulFilledDate = fulFilledDate;
Commision = commission;
}
..........
If I do then then my code still compiles fine BUT when I call GetService to instantiate the object a run time error will occur.
Thanks.
How can I modify my code so that compile time errors are received and I can fix them quickly and easily.