Page 1 of 1

LinqConnect WCF DataService

Posted: Wed 10 May 2017 07:34
by davgut
Hi,
I am trying to setup a WCF Data Services solution to be able to serve remote clients data from the generated "datacontext". Do you any samples or guides to help me with this setup?

I have setup a service with the following code:
public class WcfDataService1 : DataService<DigRAD.v46.Win.Core.DrbLinqSql.DrbDataContext>
{
// This method is called only once to initialize service-wide policies.
public static void InitializeService(DataServiceConfiguration config)
{
// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
// Examples:
config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
// config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
}
}

When I try to browse the service I get the following exception:
On data context type 'DrbDataContext', there is a top IQueryable property 'AcntClientMasters' 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.

Best regards
David Gutefeldt

Re: LinqConnect WCF DataService

Posted: Wed 10 May 2017 15:38
by Shalex
WCF Data Services requires each entity to have a key defined: http://stackoverflow.com/questions/6180 ... inq-to-sql.

JIC:
Entity Developer allows to set custom attributes:
a) navigate to Model > Settings > Attributes > select the assembly with the needed attributes and make sure that the needed attributes are checked in the window below, press OK
b) select the needed attribute in the Attributes collection of a particular class property