views:

13

answers:

0

I'm trying to add a new instance of an object to my data source, and there's a foreign key defined for ListUserName. The CurrentUser object is the right type to put into it and is populated correctly, but it blows up on me when submitting it to the data source.

This is all pulled from a Domain service class into the Silverlight app.

ListUserList ListToAdd = new ListUserList();
ListToAdd.ListID = System.Guid.NewGuid();
ListToAdd.ListName = NewListName;
ListToAdd.CreatedDate = System.DateTime.Now;

//this is the foreign key reference to another table
ListToAdd.ListUsersName = CurrentUser;

listUserListDomainDataSource.DataView.Add(ListToAdd);

try
{
   listUserListDomainDataSource.SubmitChanges();
}

Just as a note, if I create a new ListUserName instance and populate it instead of using the existing CurrentUser object it works just fine.