Exemple #1
0
        private List <ResultObjectMapping> LoadData(QueryModel queryModel)
        {
            var sqlCommand =
                SqlGeneratorQueryModelVisitor.GenerateSqlQuery(
                    queryModel,
                    Locator,
                    ConverterFactory,
                    ExtensibilityProvider);

            var resultItems = new List <ResultObjectMapping>();

            DatabaseQuery.Execute(sqlCommand.CreateQuery(), dr => resultItems.Add(sqlCommand.ProcessRow(dr)));

            if (queryModel.ResultOperators.Any(it => it is LastResultOperator) && resultItems.Count > 1)
            {
                resultItems.RemoveRange(0, resultItems.Count - 1);
            }
            return(resultItems);
        }
		public static SqlCommandData GenerateSqlQuery(
			QueryModel queryModel,
			IServiceProvider locator,
			IOracleConverterFactory converterFactory,
			IExtensibilityProvider extensibilityProvider)
		{
			Contract.Requires(queryModel != null);
			Contract.Requires(locator != null);
			Contract.Requires(converterFactory != null);
			Contract.Requires(extensibilityProvider != null);

			var visitor =
				new SqlGeneratorQueryModelVisitor(
					new MainQueryParts(
						locator,
						converterFactory,
						extensibilityProvider.ResolvePlugins<IQuerySimplification>(),
						extensibilityProvider.ResolvePlugins<IExpressionMatcher>(),
						extensibilityProvider.ResolvePlugins<IMemberMatcher>(),
						extensibilityProvider.ResolvePlugins<IProjectionMatcher>()));
			visitor.VisitQueryModel(queryModel);
			return new SqlCommandData(visitor.QueryParts);
		}
Exemple #3
0
        public static SqlCommandData GenerateSqlQuery(
            QueryModel queryModel,
            IServiceProvider locator,
            IOracleConverterFactory converterFactory,
            IExtensibilityProvider extensibilityProvider)
        {
            Contract.Requires(queryModel != null);
            Contract.Requires(locator != null);
            Contract.Requires(converterFactory != null);
            Contract.Requires(extensibilityProvider != null);

            var visitor =
                new SqlGeneratorQueryModelVisitor(
                    new MainQueryParts(
                        locator,
                        converterFactory,
                        extensibilityProvider.ResolvePlugins <IQuerySimplification>(),
                        extensibilityProvider.ResolvePlugins <IExpressionMatcher>(),
                        extensibilityProvider.ResolvePlugins <IMemberMatcher>(),
                        extensibilityProvider.ResolvePlugins <IProjectionMatcher>()));

            visitor.VisitQueryModel(queryModel);
            return(new SqlCommandData(visitor.QueryParts));
        }