3

The rest of my team are working on a Lightswitch CRUD & reporting app, and I'm looking at migrating a load of legacy data into the underlying SQL Server database they're using.

Their Lightswitch app already exposes a domain model (based on Entity Framework, I believe) - so I can add a reference to LightSwitchApplication.Common to my console migration app and then reference classes like LightSwitchApplication.Customer, LightSwitchApplication.Volunteer, and so on...

What kind of setup/data context do I need to do in my console app to be able to load and save these domain objects? It's not obvious from looking at the Lightswitch code and - given we're in the middle of a 48-hour charity hack weekend - a quick answer would be really appreciated!

Thanks,

Dylan

Dylan Beattie
  • 53,688
  • 35
  • 128
  • 197

1 Answers1

2

LightSwitch wasn't originally designed to allow access to anything from outside of LightSwitch itself, so it's not going to be "easy" even if it's "possible". It certainly isn't "supported".

Have a look at this article though: http://blogs.msdn.com/b/lightswitch/archive/2011/04/08/how-do-i-display-a-chart-built-on-aggregated-data-eric-erhardt.aspx

It shows you how to reuse the EF model for consumption within a LightSwitch solution, but it may just give you information that you might be able to adapt for your situation. For what it's worth, I haven't heard of anyone successfully doing what you're trying to do. I've heard of a few wanting to, just none who have succeeded.

EDIT:

My original answer was for LS V1 (2011). From LS V2 (2012) onwards, the entire data structure has been exposed as OData endpoints.

Yann Duran
  • 3,842
  • 1
  • 24
  • 24