views:

204

answers:

1

I have a Silverlight application, a WCF service with a class library with ActiveRecord entities

I need to load a list of entities from the class library in the WCF service and send it to the Silverlight application

  1. How do I initialise ActiveRecordStarter in service and establish connection to DB?
  2. How do I provide ar:sessionScope?
  3. How do I do lazy loads?

Thanks for any help and any code

A: 

You should not try to send your entities through WCF service.

Create dedicated data contract and map your entities to that contract. Then you can use AR like in any other kind of application. You could use custom IParameterInspector to open and close session scope if you're not using Windsor.

Krzysztof Koźmic
thanks a lot for you answer. but how to use ActiveRecordStarter in service ?
devIceMan
perhaps the easiest option would be in static constructor of your ServiceHostFactory class if you're not using something else to manage lifecycle of your service.
Krzysztof Koźmic
thanks, the static constructor really works! could you explain how to use properties with BelongsToAttribute when Lazy = FetchWhen.OnInvoke ? its always said then the session is null
devIceMan
I suggest you ask the question on Castle users group
Krzysztof Koźmic
ok. thank you very much
devIceMan