Could not locate dependency with subclasses

Topics: CAB & Smart Client Software Factory
Oct 3, 2006 at 9:57 AM
originally posted by: samueljmueller

I have a view called AccountView, and it's presenter has a ComponentDependency in the constructor:
InjectionConstructor
public AccountViewPresenter(
ComponentDependency(WorkItemNames.Account) Account account) {
this.account = account;
}

So, when creating the view, I first add to the WorkItem items collection like so:
WorkItem.Items.Add(account, WorkItemNames.Account);

and then creating a new View:
accountView = WorkItem.SmartParts.AddNew<AccountView>();

This works great except when my Account object is really a subclass of Account (i.e. CustomerAccount : Account). Then, I get the error: Could not locate dependency "Is3.Logic.Commerce.Interface.Model.Account".

It seems that the ObjectBuilder cannot tell that the object is indeed of type Account. Is there a way to get around this?
Oct 17, 2006 at 6:13 AM
originally posted by: samueljmueller

Can someone help with a solution or workaround for this problem?
Nov 14, 2006 at 8:46 AM
originally posted by: samueljmueller

Has nobody encountered this issue? I would think it would be a common problem.
Nov 15, 2006 at 3:30 PM
originally posted by: PauloMorgado

See if this helps:

http://msmvps.com/blogs/paulomorgado/archive/2006/10/22/Enhancing-CAB_2700_s-ManagedObjectCollection.aspx