1 //Copyright 2010 Microsoft Corporation
2 //
3 //Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
4 //You may obtain a copy of the License at
5 //
6 //http://www.apache.org/licenses/LICENSE-2.0
7 //
8 //Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
9 //"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 //See the License for the specific language governing permissions and limitations under the License.
11 
12 
13 namespace System.Data.Services.Client
14 {
15     using System;
16     using System.Diagnostics;
17     using System.Linq.Expressions;
18 
19     [DebuggerDisplay("InputReferenceExpression -> {Type}")]
20     internal sealed class InputReferenceExpression : Expression
21     {
22         private ResourceExpression target;
23 
InputReferenceExpression(ResourceExpression target)24         internal InputReferenceExpression(ResourceExpression target)
25             : base((ExpressionType)ResourceExpressionType.InputReference, target.ResourceType)
26         {
27             Debug.Assert(target != null, "Target resource set cannot be null");
28             this.target = target;
29         }
30 
31         internal ResourceExpression Target
32         {
33             get { return this.target; }
34         }
35 
OverrideTarget(ResourceSetExpression newTarget)36         internal void OverrideTarget(ResourceSetExpression newTarget)
37         {
38             Debug.Assert(newTarget != null, "Resource set cannot be null");
39             Debug.Assert(newTarget.ResourceType.Equals(this.Type), "Cannot reference a resource set with a different resource type");
40 
41             this.target = newTarget;
42         }
43     }
44 }
45