Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working, if ViewModelBaseType is a class (e.g. PropertyChangedBase) #19

Open
RufusJWB opened this issue Jun 4, 2016 · 0 comments
Open

Comments

@RufusJWB
Copy link

RufusJWB commented Jun 4, 2016

The automatic registration of ViewModels is not working, if the ViewModelBaseType is set to a class and not an interface. To solve this problem you should change in the Configure method the registration of ViewModels to:

// register view models
builder.RegisterAssemblyTypes(AssemblySource.Instance.ToArray())
// must be a type with a name that ends with ViewModel
.Where(type => type.Name.EndsWith("ViewModel"))
// must be in a namespace ending with ViewModels
.Where(type => EnforceNamespaceConvention ? (!(string.IsNullOrWhiteSpace(type.Namespace)) && type.Namespace.EndsWith("ViewModels")) : true)
// must implement INotifyPropertyChanged (deriving from PropertyChangedBase will statisfy this)
////.Where(type => type.GetInterface(ViewModelBaseType.Name, false) != null)

.Where(type => ViewModelBaseType.IsAssignableFrom(type))

// registered as self
.AsSelf()
// always create a new one
.InstancePerDependency();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant