WCF portal hosted in WAS

WCF portal hosted in WAS

Old forum URL: forums.lhotka.net/forums/t/5473.aspx


ixman posted on Friday, September 26, 2008

Hi,

I need a way to dynamically instantiate some objects before calling Dataportal.XYZ using WCF portal hosted in IIS7(WAS). For example I have a static class that holds things like connection strings and so on… This static class should be initialized before the DataPortal.XYZ methods use a property from these objects. Any ideas?

Kind regards,

George B

RockfordLhotka replied on Friday, September 26, 2008

There are two options.

In CSLA 3.0+ you can add code into your custom base classes, in the DataPortal_OnDataPortalInvoke() override, to see if you need to initialize the static data. This presupposes you have your own custom base classes, and all your business objects inherit from your base classes.

In CSLA 3.6+ you can supply a custom authentication provider that is invoked on every data portal call, before any other processing occurs. You could see if you need to initialize the static data in this method.

ixman replied on Monday, September 29, 2008

Thank you,

I found a way but seemed more like a hack to me... I've derived from ServiceHostFactory and then I've overridden the ApplyConfiguration method and injected my custom initialization code...

Anyway your solution seems far more elegant...

Thanks,

GB

Copyright (c) Marimer LLC