已答覆 wcf data services with custom data provider

  • Tuesday, July 31, 2012 4:06 PM
     
     

    hi guy's,

    i am storing data in a cache 
    and i want to supply the same ODATA capabilities  that data services supply
    is there a way to do it with custom source instead of sql server
    i want to build a simple wcf service that achieve these capablilities

    thanks 

    shlomi

All Replies

  • Tuesday, July 31, 2012 5:27 PM
     
     
    you can use Reflection Provider that allow building ODATA services with in memory objects
  • Tuesday, July 31, 2012 8:43 PM
     
     

    hi 

    it sound like i can use it
    but i have two questions 

    1) if you see this link
        http://msdn.microsoft.com/en-us/library/dd728281.aspx
    t
    hey explained how implemet it but i dont understand who call this method xxx to initiate the data

    2) my data is stored on .net 4 memorycahce 
        this how the store in filling up
        a) user invoke a request using rest service - async call, this call is split to a couple of calls when each call return the return data is stored in the cache
            * each call from the splited request can return in a diffrent time
        b) user ask the cache if any data has returned
        c) if data has returned i want to give him the option to quert the data as odata request
            but he can query only his result from the request he made before
        

        the reason i explained all this it because i created lock mechanisem for each pair of key value in the cache 
        so when data has return form the request it will lock only specific pair of values 
        
        my question is how do i implement the data  that in oder to get the data i need to pulled it from the cache using specific key
        second question : i want to read the data from cache using thread safe get-metohd i implemented 
        

         * just to remaind you it is possible that the user query the some of the result and at the same time a newer result eil be added to data
              now it thread safe because im access the data with read write lock 

    thank you 

    shlomi

  • Wednesday, August 01, 2012 12:29 PM
     
     

    First Question 

    1. Create a dummy Data Service Application  as described here http://msdn.microsoft.com/en-us/library/dd728275.aspx
    2. Once Done Replace your data service class implementation with code provide in above article and access is via SVC it self (If you need I can submit a code sample on MSDN)

    Second Question 

    The requirement you told looks feasible but you need to write wrapper classes over your cache, for right architecture we may need to dig in to deeper.

    Ashwini 

  • Wednesday, August 01, 2012 12:40 PM
     
     

    hi ashwini,

    thanks for the answer i will check it 
    if you can submit the the code it will help me
    again thanks for the helpful answer

    have a nice day

    shlomi

  • Wednesday, August 01, 2012 1:21 PM
     
     Answered

    Submitted a code sample WCF Data Service (OData) Reflection Provider Code Sample (Step By Step) This will answer first part of your question posted above 

    Let`s see if it works for you , then you may need to open separate question for cache wrapping architecture 

    • Marked As Answer by shlomihassan Wednesday, August 01, 2012 3:56 PM
    •  
  • Thursday, August 02, 2012 8:01 AM
     
     

    hi ashwini

    first of all big thanks for the step by step tutorial 
    second i will apritiate help from you with the dictionary problem

    have a nice day

    shlomi

  • Friday, August 03, 2012 3:47 AM
     
     

    sure ,

    will suggest you to open a separate thread  with more details of your cache architecture i.e what object, framework etc, code samples so that you will get best reply . I may suggest you to put the title like "Design Suggestion for publishing data cache via WCF Data Service" so that it is more I catchy 

    ashwini