private DbCommand PrepareCommand(FormattedExpression fe) { switch (_Connection.State) { case System.Data.ConnectionState.Closed: _Connection.Open(); goto case System.Data.ConnectionState.Open; case System.Data.ConnectionState.Open: var comm = _Connection.CreateCommand(); comm.CommandText = fe.CommandText; foreach (var p in fe.Parameters) AddParameter(p, comm); return comm; default: throw new NotImplementedException("Not sure what to do here yet..."); } }
private object ExecuteResult(FormattedExpression fe) { using (var command = PrepareCommand(fe)) using (var reader = command.ExecuteReader()) { return QueryMaterializer.Materialize(reader, fe.Expression.Projection, _Context); } }
private object ExecuteScalar(FormattedExpression te) { return null; }