Page 1 of 1

how to use cobra keywords as type member?

PostPosted: Wed Aug 05, 2009 11:49 am
by gauthier
I'm failing to compile this

use Castle.ActiveRecord

class MapTestWhere
has ActiveRecord("map")

pro foos as Foo*
has HasMany(where ="foo.bar = 1")

class Foo
has ActiveRecord("foo")
pro key from var as Guid
has PrimaryKey
pro bar from var as String
has Property

class Program
shared
def main
pass


giving
Code: Select all
test.cobra(7): error: test.cobra(7,15): error: Expecting an expression. "where" is a reserved keyword that is not expected here.
Compilation failed - 1 error, 0 warnings
Not running due to errors above.


I need to use Where property setter in the attribute constructor, is there any workaround?

Re: how to use cobra keywords as type member?

PostPosted: Wed Aug 05, 2009 12:06 pm
by gauthier
just to indicate that I've found a workaround by

- inheriting HasManyAttribute
- making specialized constructor:
cue init(whereExpression as String)
base.init
.where = whereExpression

Re: how to use cobra keywords as type member?

PostPosted: Wed Aug 05, 2009 10:39 pm
by Charles
Fixed. Thanks for the report.