public DslDataQuery FromText(string queryText, long?projectId, bool isSystem)
        {
            if (string.IsNullOrEmpty(queryText))
            {
                throw new ArgumentNullException(nameof(queryText));
            }

            var queryModel = _queryTranslator.ToQuery(queryText);

            _queryModelAccessValidator.Validate(queryModel, projectId, isSystem);

            return(queryModel);
        }
예제 #2
0
        public void ShouldNotThrowExceptionWhenDataSourceDoesNotExists()
        {
            const string entityName = "entity";

            var query = new DslDataQuery
            {
                QueryEntityName = entityName
            };

            const long userId = 523243;

            long?projectId = 423434;

            var userInfo = new UserInfo
            {
                Id = userId
            };

            _userPrincipal.Setup(_ => _.Info).Returns(userInfo);

            _dataSourceInfoProvider.Setup(_ => _.Get(entityName, userId)).Returns((DataSourceInfo)null);

            _target.Validate(query, projectId, false);
        }