Argghhh the sample needs to be fixed badly on this page, it use string
concatenation to assemble SQL statements (which is PLAIN EVIL,
especilally with string parameter...).
what I use (when SQL is a requirement):
var list = (IList) ActiveRecordMediator<AnyEntity>.Execute(
(session, useless) =>
session
.CreateSQL("select something from somewhere where column
= :aValue")
.SetParameter("aValue", 42)
.List()
,
null
);
On Dec 10, 11:19 pm, "Patrick Steele" <[EMAIL PROTECTED]>
wrote:
> Have you checked out this:
>
> http://www.castleproject.org/activerecord/documentation/trunk/usersgu...
>
> --
> Patrick Steelehttp://weblogs.asp.net/psteele
>
> On Wed, Dec 10, 2008 at 2:56 PM, M Kenyon II <[EMAIL PROTECTED]> wrote:
>
>
>
> > I saw a sample here:
> >http://ayende.com/Blog/archive/2006/11/22/ComplexQueriesWithActiveRec...
>
> > What I want to do is this:
> > select Week, WeeksOvertime from
> > GetBdgClassWeekOvertime(?,?,?)
>
> > I tried this:
> > System.Text.StringBuilder WeekOvertimeRequest = new
> > System.Text.StringBuilder();
> > WeekOvertimeRequest.Append("select Week, WeeksOvertime
> > from ");
> > WeekOvertimeRequest.Append("GetBdgClassWeekOvertime
> > (?,?,?)"); // :ClassID,:sDate,:eDate)");
> > SimpleQuery<object[][]> WeekOvertimeQuery = new
> > SimpleQuery<object[][]>(QueryLanguage.Sql, WeekOvertimeRequest.ToString
> > (), Classification.ID, startDate.ToShortDateString(),
> > endDate.ToShortDateString());
>
> > object[][] WeekOvertimeResults = WeekOvertimeQuery.Execute
> > ();
>
> > But I get this error:
> > You have accessed an ActiveRecord class that wasn't properly
> > initialized. The only explanation is that the call to
> > ActiveRecordStarter.Initialize() didn't include System.Object[][]
> > class
> > Description: An unhandled exception occurred during the execution of
> > the current web request. Please review the stack trace for more
> > information about the error and where it originated in the code.
>
> > Exception Details:
> > Castle.ActiveRecord.Framework.ActiveRecordException: You have accessed
> > an ActiveRecord class that wasn't properly initialized. The only
> > explanation is that the call to ActiveRecordStarter.Initialize()
> > didn't include System.Object[][] class
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---