예제 #1
0
 public void ApplyConfiguration(DataServiceConfiguration configuration, DataServiceProviderWrapper provider)
 {
     if (this.Kind == OperationKind.ServiceOperation)
     {
         this.serviceOperationRights = configuration.GetServiceOperationRights(this.ServiceOperation);
     }
     else
     {
         this.serviceActionRights = configuration.GetServiceActionRights(this.ServiceAction);
     }
     if (((this.Kind == OperationKind.ServiceOperation) && ((this.serviceOperationRights & ~System.Data.Services.ServiceOperationRights.OverrideEntitySetRights) != System.Data.Services.ServiceOperationRights.None)) || ((this.Kind == OperationKind.Action) && (this.serviceActionRights != System.Data.Services.ServiceActionRights.None)))
     {
         if (this.operation.ResourceSet != null)
         {
             this.resourceSet = provider.TryResolveResourceSet(this.operation.ResourceSet.Name);
             if (this.resourceSet == null)
             {
                 throw new InvalidOperationException(System.Data.Services.Strings.OperationWrapper_OperationResourceSetNotVisible(this.Name, this.operation.ResourceSet.Name));
             }
         }
         else if (this.ResultSetPathExpression != null)
         {
             this.ResultSetPathExpression.InitializePathSegments(provider);
         }
     }
 }
예제 #2
0
        /// <summary>
        /// Apply the given configuration to the resource set.
        /// </summary>
        /// <param name="configuration">data service configuration instance.</param>
        /// <param name="provider">data service provider wrapper instance for accessibility validation.</param>
        public void ApplyConfiguration(DataServiceConfiguration configuration, DataServiceProviderWrapper provider)
        {
#if DEBUG
            Debug.Assert(!this.isReadOnly, "Can only apply the configuration once.");
#endif
            if (this.Kind == OperationKind.ServiceOperation)
            {
                this.serviceOperationRights = configuration.GetServiceOperationRights(this.ServiceOperation);
            }
            else
            {
                Debug.Assert(this.Kind == OperationKind.Action, "this.Kind == OperationKind.Action");
                this.serviceActionRights = configuration.GetServiceActionRights(this.ServiceAction);
            }

            if ((this.Kind == OperationKind.ServiceOperation && (this.serviceOperationRights & ~ServiceOperationRights.OverrideEntitySetRights) != ServiceOperationRights.None) ||
                (this.Kind == OperationKind.Action && this.serviceActionRights != Service.ServiceActionRights.None))
            {
                if (this.operation.ResourceSet != null)
                {
                    // If the result type is an entity type, we need to make sure its entity set is visible.
                    // If the entity set is hidden, we need to make sure that we throw an exception.
                    this.resourceSet = provider.TryResolveResourceSet(this.operation.ResourceSet.Name);
                    if (this.resourceSet == null)
                    {
                        throw new InvalidOperationException(Strings.OperationWrapper_OperationResourceSetNotVisible(this.Name, this.operation.ResourceSet.Name));
                    }
                }
                else if (this.ResultSetPathExpression != null)
                {
                    this.ResultSetPathExpression.InitializePathSegments(provider);
                }
            }
#if DEBUG
            this.isReadOnly = true;
#endif
        }
예제 #3
0
        /// <summary>
        /// Apply the given configuration to the resource set.
        /// </summary>
        /// <param name="configuration">data service configuration instance.</param>
        /// <param name="provider">data service provider wrapper instance for accessibility validation.</param>
        public void ApplyConfiguration(DataServiceConfiguration configuration, DataServiceProviderWrapper provider)
        {
#if DEBUG
            Debug.Assert(!this.isReadOnly, "Can only apply the configuration once.");
#endif
            if (this.Kind == OperationKind.ServiceOperation)
            {
                this.serviceOperationRights = configuration.GetServiceOperationRights(this.ServiceOperation);
            }
            else
            {
                Debug.Assert(this.Kind == OperationKind.Action, "this.Kind == OperationKind.Action");
                this.serviceActionRights = configuration.GetServiceActionRights(this.ServiceAction);
            }

            if ((this.Kind == OperationKind.ServiceOperation && (this.serviceOperationRights & ~ServiceOperationRights.OverrideEntitySetRights) != ServiceOperationRights.None) ||
                (this.Kind == OperationKind.Action && this.serviceActionRights != Service.ServiceActionRights.None))
            {
                if (this.operation.ResourceSet != null)
                {
                    // If the result type is an entity type, we need to make sure its entity set is visible.
                    // If the entity set is hidden, we need to make sure that we throw an exception.
                    this.resourceSet = provider.TryResolveResourceSet(this.operation.ResourceSet.Name);
                    if (this.resourceSet == null)
                    {
                        throw new InvalidOperationException(Strings.OperationWrapper_OperationResourceSetNotVisible(this.Name, this.operation.ResourceSet.Name));
                    }
                }
                else if (this.ResultSetPathExpression != null)
                {
                    this.ResultSetPathExpression.InitializePathSegments(provider);
                }
            }
#if DEBUG
            this.isReadOnly = true;
#endif
        }