Converting one Object to Another ObjectConverting one Object to Another Object
Old forum URL: forums.lhotka.net/forums/t/6405.aspx
pac posted on Wednesday, February 11, 2009
Hi,
We have a use case where a user has a set of tasks to complete, if the users tasks are empty (ie. first timer) in the local database it will go and populate a set of new tasks based on the users type from a global database.
We have two Lists UserTaskItemList which contains UserTaskItems and GlobalTaskItemList which contains GlobalTaskItems. The GlobalTaskItemList has a factory method of GetGlobalTaskItemList(GUID UserType) to return a global list of tasks based on the user type. My question is where does the responsibility lie for converting the GlobalTaskItemList to a UserTaskItemList? Keeping in mind that UserTaskItems is quite similar to GlobalTaskItems and we also do not wish to save the UserTaskItems into the local database just yet, we only want to populate the UserTaskItemList to show the user and let them decide whether they want to call save or not. If they decide to run a task from the list it will then go and save the list to the local database for future reference.
Thanks in Advance
- Paulajj3085 replied on Thursday, February 12, 2009
Well, it goes in a new class, the GlobalTaskToUserTaskConverter.
Copyright (c) Marimer LLC