Search code examples
c#wcfcastle-activerecord

How can i use Castle.ActiveRecord in WCF service?


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


Solution

  • 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.