コード例 #1
0
        /// <summary>Constructs the operation selector for runtime.</summary>
        /// <param name="endpoint">End point.</param>
        /// <param name="metadata">Domain data service metadata.</param>
        public DomainDataServiceOperationSelector(
            ServiceEndpoint endpoint,
            DomainDataServiceMetadata metadata)
            : base(DomainDataServiceOperationSelector.ExtractNonRootQueryServiceOperations(endpoint, metadata))
        {
            this.baseUri = endpoint.ListenUri;
            this.serviceRootQueryOperations = new Dictionary <string, string>();

            // Collect all the query operations, since they are to be handled by selector in this class.
            foreach (var od in endpoint.Contract.Operations)
            {
                string resourceSetName = DomainDataServiceOperationSelector.GetRootQueryOperation(od, metadata);
                if (!String.IsNullOrEmpty(resourceSetName))
                {
                    Debug.Assert(!this.serviceRootQueryOperations.ContainsKey(resourceSetName), "There should only be 1 default query operation per set.");

                    // Note the fact that requests on resourceSet correspond to the given operation.
                    this.serviceRootQueryOperations.Add(resourceSetName, od.Name);
                }
            }
        }