This project is read-only.

Dataservice, Winforms, and REST

Oct 28, 2009 at 5:57 AM

Maybe I am just dense...  I am looking to use the Dataservice in a WinForms scenario but am having trouble seeing how to connect everything together using the REST services.  It is probably past experience blocking me from seeing how this works as I have used WCF and had visual studio create the client side proxies in the past....  I thought I had found the solution in the ConfigurationValues.cs file DataAccessServiceUrl property, but then realized that it had been depreciated, in addition to that project not referencing the DTO objects.  Can someone give me a kickstart on how to access the rest services??  BTW, the more I dig into nHydrate, the more I am impressed....  I hope it will workout for my project(s)..Now if I could just get it to work!!

Thanks,

Dave

Oct 28, 2009 at 5:49 PM

First off you are not dense.

You are actually hitting on something that we is planned in our roadmap. The roadmap can be viewed  on the blog at

http://nhydrate.blogspot.com/

The specific item in discussion is below.

• IOC layer behind the DTO extension methods to handle Client side {WCF / Restful} or Service Side {Direct Connect} configuration

Currently we deployed our DTO layer via a set of rest services. Those rest services can be accessed directly from a client form project. So what we are saying here is no WebService based support only Restful at this point.

So what is your resolution while you wait.

1. You can use the Rest services directly from your winforms app.

OR

2. You can write your own WCF services on top of the DTO layer provided

 

Oct 29, 2009 at 3:09 AM

Hi, Thanks for the info.  Any idea on what kind of timeframe the WCF dataservice will be available??  I understand if you don't want to put a timeframe on it...  

I have looked into implementing my own WCF service using the DTO objects, but unfortunatly the properties have not been decorated with the [DataMember] attribute.  When I added [DataMember] attribute, it seemed to work as expected.

Thanks,

Dave

Oct 29, 2009 at 1:31 PM

Get the latest version, DataMember is now a decoration. I do not have a timeline for the other stuff right now.

May 11, 2010 at 1:49 AM
Edited May 11, 2010 at 2:18 AM

davesdig: "Can someone give me a kickstart on how to access the rest services?"
msktenn1: "You can use the Rest services directly from your winforms app"

Please excuse my pointing out that this does not answer the question.

I'm asking the same thing. I've referenced the datatransfer and interface projects. I tried to add a service reference to the DataService but it didn't work and nobody would help me resolve it. I'm now trying this code:

            WebRequest myRequest = WebRequest.Create("http://localhost:11306/Rest.svc/OfficerList");

            WebResponse myResponse = myRequest.GetResponse();

            DataContractSerializer RecData = new DataContractSerializer(typeof(List<OfficerDTO>));

                        try

            { 

               var CollectionOfficers = RecData.ReadObject(myResponse.GetResponseStream());

                List<OfficerDTO> Officers = (List<OfficerDTO>)CollectionOfficers;

                dgOfficers.ItemsSource = Officers;

            }

            catch (Exception ex)

            {

                throw ex;

            }

 

...but it's hassling me about

"There was an error deserializing the object of type System.Collections.Generic.List`1[[mySolution.DataTransfer.OfficerDTO, mySolution.DataTransfer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]. The data at the root level is invalid. Line 1, position 1."

Anyone had this before?