Hi,
I am trying to implement the Model View View Model pattern and I understand that the Model shouldn't have any references back to the View Model where the databindings are. I have databindings to Owners and Task tables and understand the task is mapped to owner as part of the Tasks.AllProperties field. However, all the examples seem to indicate that I should setup a Task and then use Task.Save() to populate the Tasks.AllProperties field. But in order to construct that class, my Model needs to have knowledge of the ViewModel's databinding class because that is where the ultraCalendarInfo is stored, which has the method to create a task.
Is there a way to populate the database fields without using that Task.Save() method so that I can keep my databindings cleanly separated from my model?
Thanks,
Myca
I should also mention that my design requirements are that tasks are only assigned to a single resource.
Hello Myca,
Thank you for contacting Infragistics.
I am currently researching this. I will update this thread by the end of the week with more information.
I created the attached sample as a starting point for researching your question. As long as you're exposing some kind of data source from your ViewModel along with string properties to assign to the various *Member properties off the DataBindingsForProjects and the DataBindingsForTasks properties, it should work properly.
It would be very helpful if you could provide us with a sample project which demonstrates what you have so far along with the issue you're facing.
Please let me know if you have any other questions about this.
Hi Dave,
Thank you for the sample code. I looked at the code, but it seems like the database table gets updated with a DataRow, but I'm not sure how to populate the AllProperties byte array for that DataRow. I am attaching a sample project to show how I am currently populating the data row. It will give compile errors because I cannot upload the data messages that make up our DataAccess classes, but all my MVVM classes are all there.
The DataAccess.COM_Component class has callbacks named "OnDataReceived". Those methods are what updates the ProgramRepository's database tables. I need to be able to say something like this there:
byte[] allProperties;
//allProperties = tasks.Save() //I have no links to the Tasks definition because it is associated with the view and this layer only talks to the database tables.
newRow["AllProperties"];
Maybe this is in your code example and I'm just having trouble mapping it into the way I'm updating my tables. But basically, I just need to understand how to populate that byte array.
Thanks again,
Hello Myca.
Thank you for your response.
I recommend creating a byte array property on your ViewModel that the View will set in response to a button click or some other event where you want to send the data to the database.
Actually, I see what you mean now. I've found some other posts that show how a Combo Box populates a byte array. Thank you for your help.