Payload Injection into LS Application...
-
Wednesday, May 02, 2012 7:34 PM
The LS framework and application development environment makes it incredibly easy to create rich powerful applications. The empahsis is now more about what the client wants rather than how are we going to do it.
That aside LS applications can exist as islands operating in their own right, but they can equally exist as part of much larger business system.
It is in this context I'm wondering about the best way to architect a solution with LS 2011 and to receive messages/events from remote systems and then have that data consumed, or stored in my Lightswitch application.
oData services allow authenticated external systems to communicate with my LS application, but it also requires that the call graph and business logic of building a valid entity data set also sit remotely to my LS application, this potentially causes ripple effects should I want to extend or change the way in which I want to do things.
In addition I don't want to necessarily expose all my Data Sevices and would like to have had control over what Entities and Operations are actually exposed. I can wish...
Currently...
To give myself a level of encapsulation I've created the following approach;-
Entity => Message In
This is exposed and via oData it takes an XML string / a serialized object. This can be de-serialized and then the code within my LS application is responsible for how it processes the data and commits this to my entity model, server side on the Saved event.
I then don't then have to bleed out across my domain apps the logic of how to pass data at an oData level.
Best Practice or another way...
I know this works, and works well, but just wondered if the LS team had a better approach to this architectural challenge. Thanks for a great product and any insights or best practice ideas would be appreciated.
Thanks,
Steve
PS: You give us the tools and we will push the boundaries !!
Steve
All Replies
-
Friday, May 04, 2012 1:48 AM
You can shut off the normal LightSwitch OData services and expose your own:
Calling Your Custom WCF RIA Services Using OData
-
Friday, May 04, 2012 5:06 PM
Hi Michael,
Great article, not sure if that provides a complete solution?
So do you think I could create a Custom RIA Service within the LS Project, which then gives me access to the LS Model? What do you think?
Ordinarily Custom RIA Services are typically external project class libraries interfacing to SQL etc... What I'm trying to do is in effect expose a Custom RIA Service as an oData service from within my LS application, and then when invoked, use the LS Model of my application to update and persist my app data.
Make sense?
Thanks,
Steve
Steve
-
Friday, May 04, 2012 5:21 PM
Hi Michael,
Great article, not sure if that provides a complete solution?
So do you think I could create a Custom RIA Service within the LS Project, which then gives me access to the LS Model? What do you think?
Ordinarily Custom RIA Services are typically external project class libraries interfacing to SQL etc... What I'm trying to do is in effect expose a Custom RIA Service as an oData service from within my LS application, and then when invoked, use the LS Model of my application to update and persist my app data.
Make sense?
Thanks,
Steve
Steve
In that article it says:
We start with the code from the article: WCF RIA Service: Combining Two Tables.
In that example you will see that it is pointing to the Internal LightSwitch database.
The Visual Studio LightSwitch Marketplace
http://LightSwitchHelpWebsite.com
- Marked As Answer by SteveHiggon Friday, May 04, 2012 5:29 PM
- Edited by ADefwebserverMVP Friday, May 04, 2012 6:41 PM
-
Friday, May 04, 2012 5:29 PM
Yes you are right - I'd read another article of yours which I thought you were referring to, my mistake.
In LS 2014++ it would be great to have something like this kind of capability without the hoops to jump through to make it work.
In the mean time thanks for the articles and pointers to the solutions.
Steve
Steve
-
Friday, May 04, 2012 6:40 PM
Yes you are right - I'd read another article of yours which I thought you were referring to, my mistake.
In LS 2014++ it would be great to have something like this kind of capability without the hoops to jump through to make it work.
In the mean time thanks for the articles and pointers to the solutions.
Steve
Steve
The team has indicated that it is possible to control the OData output (and to handle computed fields).
However, my opinion is that creating our own WCF RIA Services/OData points is not too hard and only takes a few minutes.
Also, they risk adding "configuration complexity" that provides the source material for forum questions titled "...why is this not working..." :)

