I have a rather large project and i need to use WCF for a simple CommandBase object. I have no trouble creating a project that fully utilizes WCF or one that doesnt. It seems that csla uses the configurations included in the config file of the starting project for setting the WCF dataportalproxy. Does anyone know whether what i am trying to do is possible or not?
can i use more than one type of data access in the same project?
I am afraid your question is to vague to answer.
Are you trying to:
I have been using the localproxy so far in my project. In small networks it seems to work well. I am lately trying to incorporate sms services in the project using a gsm modem. It all works fine, but i need to give this ability to all network users. So i need the modem to be connected to the server and the serverside of a commandbase object to get this done.
I would like to incorporate this into my existing project without creating a new one. I would rather leave most of the application as it is and only use the server side object for sending and receiving text messages.
Thank you for your help Rocky. This framework has helped me make my work (and life!) a lot easier. And somehow you keep making it better!
You really have two options.
One is to have your command object invoke a standalone WCF server on the server that interacts with the modem. In this case the data portal would still be in local mode, and your "data access" code is just making a service call. This is probably the simplest solution, but does not allow the command object to actually travel to the server to do its work.
Another is to use the remote data portal for this one type of object. To do this you need to create a custom data portal proxy, which is not terribly difficult - just implement IDataPortalProxy and delegate to LocalProxy or WcfProxy based on the type of business object (or you could define a custom attribute and route based on the attribute). This is a little harder, but arguably more elegant - and it does allow the command object to travel to the server to do its work.
If you are just trying to use the local data portal and one additional remote portal, then it isn't hard at all to change CSLA to do this.
The basic pieces are already in place -- GetDataPortalProxy() already takes a "forceLocal" parameter, so the idea is to configure CSLA to use a remote portal via the .config file, and then force it to the local data portal on a case by case basis. (Sounds like you would want to force to the local data portal most of the time, except for the remote call that you want to do).
I posted a sample here where you could do this in a structured way by registering an event handler to allow intercepting each GetDataPortalProxy() call and deciding for each event occurrence if you wanted to force it to the local data portal. Let me see if I can dig it up...
Here was the thread where this was discussed and I posted the sample code: http://forums.lhotka.net/forums/p/6085/29512.aspx#29512
Copyright (c) Marimer LLC