Beispiel #1
0
 internal ObjectExpression(Type objectType, Expression expression, Mappings maps, int parameterCount)
 {
     _objectType = objectType;
     _expression = expression;
     _maps = maps;
     _parameterCount = parameterCount;
 }
		public void Compile(ObjectExpression oe)
		{
			_maps = oe.Mappings;
			_provider = oe.Mappings.provider;

			_nextAliasIndex = 0;
			_parameterTable = new OPathParameterTable();

			// generate the database-specific query statement (and the parameter table at the same time)
			using( StringWriter writer = new StringWriter(new StringBuilder(500)) )
			{
				WriteSqlQuery(writer, oe.Expression);
				writer.Write(_provider.LineTerminator);
				_sqlQuery = writer.ToString();
			}

			SetParameterOrder(oe);

			// all or none of the parameters have to be provided
			if( _parameterTable != null )
			{
				if( _parameterTable.Count != oe.ParameterCount )
				{
					throw new Exception("Number of parameters in the expression does not match number of parameters in the OPathQuery.");
				}
			}

#if DEBUG
			//Debug.WriteLine(_sqlQuery);
			//Debug.WriteLine("");
#endif
		}
Beispiel #3
0
		internal static ObjectExpression Parse(OPathQuery query, Mappings maps)
		{
			OPath opath = new OPath(maps);

			int paramCount;
			Expression exp = opath.Parse(query.ObjectType, query.WhereExpression, query.SortExpression, out paramCount);
			ObjectExpression oe = new ObjectExpression(query.ObjectType, exp, maps, paramCount);
			oe.baseQuery = query;

			return oe;
		}
Beispiel #4
0
		internal OPath(Mappings maps)
		{
			_maps = maps;
		}
Beispiel #5
0
 internal QueryHelper(Mappings mappings)
 {
     this.mappings = mappings;
 }
Beispiel #6
0
 /// <summary>
 /// Compiles this ObjectExpression using the mappings found the specified ObjectSpace instance.
 /// </summary>
 /// <param name="os">ObjectSpace instance to use.</param>
 /// <returns>A CompiledQuery that is the result of this instance being compiled.</returns>
 public CompiledQuery Compile(ObjectSpace os)
 {
     if( os == null ) throw new ArgumentNullException("os");
     _maps = os.context.Mappings;
     return new CompiledQuery(this);
 }
Beispiel #7
0
 public OPathSortParser(Mappings maps)
 {
     _maps = maps;
 }