Help! I'm really struggling the the DSW. After lots of trial and error, here's what is happening. (I'm using VS2010 and .Net4)
I create a new Windows class project and add a new OpenAccess domain model. For the purposes of this test, I connect to SQL2008 R2 on my laptop, pick a table called tCustomers from the database and click finish. The rlink file generates OK with one entity called TCustomer.
Next I add an empty web application project to the solution and fire up the DSW, picking the class library as the entity source and the web application as the service host. The entity TCustomer is listed in the next step of the wizard and I select 'Data Services for .NET4 version 2' as the data service to create. Click Next and Finish and the service creates OK.
The problem arises when I try to create a reference to this new service. If I add a new service reference and pick the newly created service from the wizard's services list, I get an error which basically says 'The remote server returned an error: (500) Internal Server Error.If the service is defined in the current solution, try building the solution and adding the service reference again.'
If I try to create and old-fashioned web service, I get the slightly more useful error message: '
The server encountered an error processing the request. The exception message is 'On data context type 'DataManager', there is a top IQueryable property 'TCustomers' whose element type is not an entity type. Make sure that the IQueryable property is of entity type or specify the IgnoreProperties attribute on the data context type to ignore this property.'. See server logs for more details. The exception stack trace is: ...'.
So after much testing and trial and error, I found that if I change the name of the table from tCustomers to Customers and repeat the above steps, everything works fine! I can create a service reference or web service without any problems at all.
However, if I keep the table name the same (tCustomers) and use the OpenAccess domain wizard to strip the t from the name of the entity (or simply rename the entity to Customer in the domain model viewer), I get to the issue where DSW does not list the entity in the grid as the table name is different from the entity name, so DSW will not proceed further.
This is very frustrating as I have spent about 3 days on a really large database schema renaming entities and properties to make them more understandable in the domain model and whereas this does generate a working context, the whole point of the exercise was to move to a services oriented approach to the new applications being developed. And of course this does not seem to work.
Also, it is not possible simply to rename the tables to make everything work as this is a live system and the services model needs to be developed alongside the existing databases and stored procs until the updated applications can take over.
Am I doing something wrong, or what is happening here?