Example #1
0
        private DataSourceStubReference ComputeDataSourceStubReference(
            MethodCallExpression methodCall)
        {
            DataSourceStubReference 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 DataSourceStubReference(
                            this.QueryContext, nameValue);
                    }
                    else
                    {
                        modelReference = new DataSourceStubReference(
                            this.QueryContext,
                            namespaceName.Value as string,
                            nameValue);
                    }
                }
            }

            return(modelReference);
        }
        private DataSourceStubReference ComputeDataSourceStubReference(
            MethodCallExpression methodCall)
        {
            DataSourceStubReference 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 DataSourceStubReference(
                            this.QueryContext, nameValue);
                    }
                    else
                    {
                        modelReference = new DataSourceStubReference(
                            this.QueryContext,
                            namespaceName.Value as string,
                            nameValue);
                    }
                }
            }

            return modelReference;
        }