我正在尝试将新的保存Person
到数据库中。我的代码编译得很好,但是当我运行它时,我在.Add()
.
错误说,“ This EntitySet of Type 'Diavik.DataAccess.Person' does not support the 'Add' operation.
”
这是一个 SilverLight 应用程序,此文件是App.xaml.cs
.
这是我的代码:
private void OnGetPerson_Completed(LoadOperation<Person> operation)
{
Person person = operation.Entities.SingleOrDefault();
if (person == null)
{
person = new Person()
{
FirstName = WebContext.Current.User.FirstName,
LastName = WebContext.Current.User.LastName,
IlluminatorLogin = WebContext.Current.User.Name
};
Context.Persons.Add(person);
}
Context.SubmitChanges(submitOp =>
{
// Some Stuff
}, null);
}
谢谢您的帮助,
亚伦