Home  /  Questions  /  Question



50   50
Oct 02, 2010


Silverlight and RIA


I'm new to Silverlight and RIA so any help would be appreciated.

I'm trying to use existing WCF services in a silverlight MVVM LOB application.  I cannot change the WCF services.

Its been very easy to consume data but saving it back to the database is not as friendly.  =)

The WCF services uses DTO's so I'm using basic repository/mappers/model classes and my own basic DomainService that leverages the repository.

The generated code is calling the Save method on the model but the model is a dumb poco that doesn't even have the method....

I'm confused because I've been able to get data with this setup very easy.

What am i missing about RIA.

Thanks!

           

//In my DomainService
            public void SaveServicePackageMeters(ServicePackageMeterModel model) 
            { 
                NominationRepository.SaveNominations(model);   
            } 

 In the code gen section
 
public void SaveServicePackageMeters(ServicePackageMeterModel model) 
 { 
             model.SaveServicePackageMeters(); 
 } 
then in the model code gen section


 
public void SaveServicePackageMeters() 
        { 
            this.OnSaveServicePackageMetersInvoking(); 
            base.InvokeAction("SaveServicePackageMeters"); 
            this.OnSaveServicePackageMetersInvoked(); 
        } 

 



50   50
Oct 02, 2010

This is what i did to get it to work but it seems wrong...

This in my ViewModel


private void OnServicePackageMeterSave(object parameter) 
         { 

             Context.SubmitChanges(); 
         } 

 Then this in my domain service

public override bool Submit(ChangeSet changeSet) 
        { 
            foreach(ChangeSetEntry x in changeSet.ChangeSetEntries) 
            { 
                ServicePackageMeterModel m = x.Entity as ServicePackageMeterModel; 
                if (m != null) 
                { 
                    SaveServicePackageMeters(m); 
                } 
            } 
            
            return true; 
        }