Current filter:
                                You should refresh the page.

                                Scenario

                                In this example, we will create a WCF IDataStore service that will be used by our client (Console Application) as a data layer. Instead of a direct connection to the database, our client will connect to a remote service and configure the WCF end point programmatically. This is usually helpful when:
                                - WCF specific customizations are required to provide custom bindings, endpoints, behavior, e.g. for a secured connection;
                                - Your WCF service is not hosted in IIS and thus no .svc files are used (e.g., when the WCF Class Library project is used).

                                Steps to implement
                                1.  Create a remote data service and client as described in the How to connect to a remote data service instead of using a direct database connection example.

                                2.  Create an EndPointHelper  class which implements the GetDataStore static method as shown in the EndPointHelper.xx file. This method will be used to configure the WCF end point on the client.
                                The key is in manual creation and custom configuration of the DataStoreClient and CachedDataStoreClient objects (you can see their default configurations by checking the source code of the CreateWCFWebServiceStore and CreateWCFTcpServiceStore methods of the DevExpress.Xpo.XpoDefault class).

                                3.  Use the GetDataStore  static method in the Main method as shown in the Program.xx file to configure end point and create a IDataStore.

                                Important notes
                                1.  Take special note that binding customizations must be done both in client and service programs.

                                2.  In XAF applications it is necessary to create a class that implements the IXpoDataStoreProvider interface and return the configured IDataStore. For additional information please refer to the How to use a custom ObjectSpaceProvider in XAF example that illustrates implementation of the IXpoDataStoreProvider interface.

                                Troubleshooting

                                1. If WCF throws the "Entity is too large" error, you can apply a standard solution from StackOverFlow: http://stackoverflow.com/questions/10122957/
                                2. If WCF throws the "The maximum string content length quota (8192) has been exceeded while reading XML data. " error, you can extend bindings in the following manner:
                                [XML]
                                <bindings> <basicHttpBinding> <binding name="ServicesBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed" > <readerQuotas maxDepth="2147483647" maxArrayLength="2147483647" maxStringContentLength="2147483647"/> </binding> </basicHttpBinding> </bindings>

                                See The maximum string content length quota (8192) has been exceeded while reading XML data

                                See also:
                                Endpoints: Addresses, Bindings, and Contracts
                                How to connect to a remote data service from a Silverlight application
                                How to implement a distributed object layer service working via WCF
                                How to create a data caching service that helps improve performance in distributed applications
                                How to connect to a remote data service instead of using a direct database connection
                                Extended IDataStore WCF-Service for tracking user access rights on the server after passing logon credentials from a client app
                                The GlobalDataClientChannelCreated or ClientChannelCreated events of the DevExpress.Xpo.DB > DataStoreClient class.

                                Files to look at:

                                Customer.cs (VB: Customer.vb)
                                EndPointHelper.cs (VB: EndPointHelper.vb)
                                Program.cs (VB: Program.vb)
                                Service1.svc.cs (VB: Service1.svc.vb)