Good day!
I create a WCF RIA Service like described in this example, but my example work with EF 6.1 and GetAllOrders
method return a collection from database.
public class RiaService : DomainService
{
[Query(IsDefault = true)]
public IQueryable<rb17> GetAllOrders()
{
var model = new Model1();
return model.Orders;
}
protected override int Count<T>(IQueryable<T> query)
{
return query.Count();
}
}
After, I create a lightswitch project, add datasource as my WCF RIA service and add screen.
But when I run a project, list screen return error:
"Unable to load data. Please check your network connection and try loading again."
.
Please explain me, where must I initialize connection? On my WCF RIA Service in method GelAllOrders
, everything works fine, method return collection as queryable when I set break point. In class Model1
already added connectionstring. Why LS request another connection?
Just checking a couple of things:
Without a unique ID property, LightSwitch will have problems with the entity, but it usually doesn't result in the error you mention. However, that error can be caused by many different things, it can be extremely difficult to track down.
The fact that you're using EF 6.1 shouldn't be a problem. It doesn't matter to LightSwitch how you create your entities, as long as they satisfy those two rules I mentioned above. Database connectivity is a common cause of that error, but when you debug you say that you can see the records being created?