1
Answer

Silverlight Application with WCF Service and EntityFramework

Vijay

Vijay

11y
1.3k
1

         I am creating Silverlight Application with using WCF Services and Entity Framework 

for Insert,Select,Update and Delete using of DataGrid.

        I got results  from Insert,Select,Update but in delete i write code like dis
 
        Person - is Class
        I used this fields - ID (PK), Name, Age

WCF :

         SampleEntities DataContext { get; set; }
         public bool Delete(Person model)
        {
            DataContext = new SampleEntities();
            DataContext.People.Remove(model);
            DataContext.SaveChanges();
            return true;
        }

xaml.cs:

         private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            if (SelectingPerson != null)
            {
                PersonServiceClient sClient = new PersonServiceClient();
                sClient.DeleteCompleted += sClient_DeleteCompleted;
                sClient.DeleteAsync(SelectingPerson);
            }
        }


        void sClient_DeleteCompleted(object sender, DeleteCompletedEventArgs e)
        {
            if (e.Error == null && e.Cancelled == false)
            {
                bool del = e.Result;
                MessageBox.Show("Row was Deleted !!");
            }
            if (e.Error != null)
            {
                MessageBox.Show(e.Error.Message);
            }
        }

 
        I getting error like this,
        "CommunicationException was unhandled by user code;The remote server returned an error: NotFound ".






Thanks !

Answers (1)