c# - Unity with repositories -
c# - Unity with repositories -
i'm new unity ioc (di in general) , have read lot of documents , watched several hr long videos on channel 9. after of that, didn't find illustration demonstrated feature set in looking for.
everything online showed can create repository, , register unity container. can inject repository view model constructors. in particular app, need back upwards parsecloud, box, dropbox , onedrive, along multiple implementations of interface. planned on creating 4 repositories, 1 each service.
does create more sense have unity register single abstract repository factory, view models can utilize fetch right repository based on app configured for?
another thing app (a task app) supports multiple implementations of itask, have basictask, gtdtask, googletask. thinking need repository method handle each implementation, , store implementation in right cloud service. how accomplish abstraction unity? best register of itask types , have abstract repository determine type belongs repository based on service user signed in to?
i want maintain page view models independent task implementation. i'll utilize datatemplates have it's target type assigned specific task type. ui can remain loosely coupled , view models not tightly coupled of repositories or implementations.
thanks help.
johnathon
register implementations not factory. view model should never touch repository. controller uses repository or update model , provides view model
c# wpf unity-container ioc-container
Comments
Post a Comment