I am writing a Silverlight 4 (could be 5) app that will run out of browser.
I need to load data from a SQL CE database and also reference GIS data that are both stored on a local drive.
The code to do both of these things will be stored in a separate data access layer assembly as it will be shared with other solutions.
How do I use the DAL assembly from the Silverlight project? Do I have to go down the P/Invoke route or is there an easier way?
RickNZ is correct. A Silverlight app can’t access a non-Silverlight library (unless its a portable library) nor can they access local files without the user uploading them. I n my opinion, the following is your list practical options:
Converting from Silverlight to WPF is typically very is since Silverlight is more or less a subset WPF. Of course this might not be an option if the other two apps are not OOB apps.
If you want to stick with Silverlight, then I would suggest writing a quick Rest service to sit on top of your DAL so your applications can access it.
Note: As per SteveChadbourne’s correction, you can use platform invocation, but only in Silverlight 5. As soon as your application makes use of this new feature, it must be run as a full-trust application on a Windows machine.