Calling a stored procedure from WPF client library RRS feed

  • Question

  • I created an Entity Data Model for a database and added a function import for a stored procedure that returns a complex type.  Then I created a WCF Data Service to expose the Entity Data Model.  Next I added a Service Reference to my client application for the WCF Data Service. My DataService class initialization and the Method definition shown below

     	public static void InitializeService(DataServiceConfiguration config)
                config.SetEntitySetPageSize("*", 100);
                config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
                config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; 
                config.DataServiceBehavior.UseMetadataKeyOrderForBuiltInProviders = true;
                config.UseVerboseErrors = true;
                //This is for stored proc calls
                config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
            public IQueryable<GetAccountInformation_Result> GetAccountData(string bankNumber, string customerId)
                return CurrentDataSource.GetAccountInformation(bankNumber, customerId).AsQueryable();   

    And in my client (c# class library), I have the below code to get the account data by bank and customer id

    	    string address = "http://companywebaddress.como/EmpireServices/EmpireDBService.svc";
                EmpireDBEntities _context = new EmpireDBEntities(address);
                _context.Credentials = CredentialCache.DefaultCredentials; 
                string queryAddress = _context.BaseUri.ToString();
                queryAddress = queryAddress + "/GetAccountData?bankNumber='0202'&customerId='Id1'";
    	Uri input = new Uri(queryAddress);

                IEnumerable<GetAccountInformation_Result> temp = _context.Execute<GetAccountInformation_Result>(input);
                foreach (DataRepository.EmpireDBService.EmpireDBModel.GetAccountInformation_Result item in temp)

    after the execute line of code, while looping through temp I get the error 'The closed type DataRepository.EmpireDBService.EmpireDBModel.GetAccountInformation_Result does not have a corresponding element settable property.'

    However when I use _context.IgnoreMissingProperties = true; I don't get the error but the data does not have any rows.

    I can take the queryAddress (url) above and can run directly on browser, which is working fine and I can see the result

    What is that I am missing here?

    Friday, December 7, 2012 6:57 PM

All replies

  • I guess your return type is a complex type in your model. In which case this is a known limitation of the client library. There are several other threads on this forum discussing this issue already.


    Vitek Karas [MSFT]

    Friday, December 7, 2012 9:22 PM