Dofactory.com
Dofactory.com
 Back to list
Views:   8.1K
Replies:  1
Archived

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(); 
        } 

 
William Doman, Oct 02, 2010
Reply 1

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; 
        } 

 
William Doman, Oct 02, 2010
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.