This is a migrated thread and some comments may be shown as answers.

Persistence of byte array using WCF RIA

1 Answer 55 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ian
Top achievements
Rank 1
Ian asked on 28 Sep 2010, 11:30 AM
Hi

I'm trying to persist a byte array (layout data from Silverlight RadDocking) using OpenAccess and WCF RIA generated using the Domain Service Wizard.  I get the warning as explained here (http://www.telerik.com/help/openaccess-orm/openaccess-tasks-howto-explicit-change-tracking.html) but have no idea of how to handle this in the context of RIA. 

Any guidance gratefully appreciated.

Thanks

Ian

1 Answer, 1 is accepted

Sort by
0
PetarP
Telerik team
answered on 01 Oct 2010, 01:22 PM
Hi Ian,

 You can expose the IObjectScope from your context class. So for example imagine that this is your context class:

public partial class NorthwindEntityDiagrams : OpenAccessContext
    {
        private static string connectionStringName = "NorthwindEntityDiagrams";
             
        private static BackendConfiguration backend = GetBackendConfiguration();
         
             
        private static MetadataSource metadataSource = XmlMetadataSource.FromAssemblyResource("EntityDiagrams.rlinq");
     
        public NorthwindEntityDiagrams()
            :base(connectionStringName, backend, metadataSource)
        { }
         
        public NorthwindEntityDiagrams(string connection)
            :base(connection, backend, metadataSource)
        { }
     
        public NorthwindEntityDiagrams(BackendConfiguration backendConfiguration)
            :base(connectionStringName, backendConfiguration, metadataSource)
        { }
             
        public NorthwindEntityDiagrams(string connection, MetadataSource metadataSource)
            :base(connection, backend, metadataSource)
        { }
         
        public NorthwindEntityDiagrams(string connection, BackendConfiguration backendConfiguration, MetadataSource metadataSource)
            :base(connection, backendConfiguration, metadataSource)
        { }
             
        public IQueryable<Category> Categories
        {
            get
            {
                return this.GetAll<Category>();
            }
        }      
         
        public static BackendConfiguration GetBackendConfiguration()
        {
            BackendConfiguration backend = new BackendConfiguration();
            backend.Backend = "mssql";
            return backend;
        }
 
        public IObjectScope GetObjectScope
        {
            get
            {
                return this.GetScope();
            }
        }
    }
The highlighted code is the one I have added. Having the scope exposed you can add the following method to your RIA data service:
public void MarkPictureAsChanged(Category category)
       {
           this.DataContext.GetObjectScope.MakeDirty(category, "Picture");           
       }
I hope this helps.


Kind regards,
Petar
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Development (API, general questions)
Asked by
Ian
Top achievements
Rank 1
Answers by
PetarP
Telerik team
Share this question
or