Forums

how to use cobra keywords as type member?

General discussion about Cobra. Releases and general news will also be posted here.
Feel free to ask questions or just say "Hello".

how to use cobra keywords as type member?

Postby gauthier » Wed Aug 05, 2009 11:49 am

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?
gauthier
 
Posts: 116

Re: how to use cobra keywords as type member?

Postby gauthier » Wed Aug 05, 2009 12:06 pm

just to indicate that I've found a workaround by

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

Re: how to use cobra keywords as type member?

Postby Charles » Wed Aug 05, 2009 10:39 pm

Fixed. Thanks for the report.
Charles
 
Posts: 2515
Location: Los Angeles, CA


Return to Discussion

Who is online

Users browsing this forum: No registered users and 4 guests

cron