Ejemplo n.º 1
0
        private ApiDataReference ComputeApiDataReference(
            MethodCallExpression methodCall)
        {
            ApiDataReference   modelReference = null;
            ConstantExpression namespaceName  = null;
            ConstantExpression name           = null;
            var argumentIndex = 0;

            if (methodCall.Method.GetParameters().Length > 2)
            {
                namespaceName = methodCall.Arguments[argumentIndex++] as ConstantExpression;
            }

            name = methodCall.Arguments[argumentIndex++] as ConstantExpression;
            if ((argumentIndex == 1 || namespaceName != null) && name != null)
            {
                var nameValue = name.Value as string;
                if (nameValue != null)
                {
                    if (namespaceName == null)
                    {
                        modelReference = new ApiDataReference(
                            this.QueryContext, nameValue);
                    }
                    else
                    {
                        modelReference = new ApiDataReference(
                            this.QueryContext,
                            namespaceName.Value as string,
                            nameValue);
                    }
                }
            }

            return(modelReference);
        }
Ejemplo n.º 2
0
        private ApiDataReference ComputeApiDataReference(
            MethodCallExpression methodCall)
        {
            ApiDataReference modelReference = null;
            ConstantExpression namespaceName = null;
            ConstantExpression name = null;
            var argumentIndex = 0;
            if (methodCall.Method.GetParameters().Length > 2)
            {
                namespaceName = methodCall.Arguments[argumentIndex++] as ConstantExpression;
            }

            name = methodCall.Arguments[argumentIndex++] as ConstantExpression;
            if ((argumentIndex == 1 || namespaceName != null) && name != null)
            {
                var nameValue = name.Value as string;
                if (nameValue != null)
                {
                    if (namespaceName == null)
                    {
                        modelReference = new ApiDataReference(
                            this.QueryContext, nameValue);
                    }
                    else
                    {
                        modelReference = new ApiDataReference(
                            this.QueryContext,
                            namespaceName.Value as string,
                            nameValue);
                    }
                }
            }

            return modelReference;
        }