locked
Preload entities into an LS table? RRS feed

  • Question

  • How can I pre-load some entities into my LS tables? ...either statically or dynamically when my LS app starts up?

    Xpert Search Agents for Microsoft web sites: http://www.parallelspace.net/MicrodeX


    Thursday, April 11, 2013 9:15 PM

Answers

All replies

  • Hey Michael,

    What type of data are you talking about?

    Lots of ways to do that.  I am happy to throw some ideas out there.

    As a disclaimer, I am a relatively new programmer to LS (a couple of months full time, part time before that), and often defer to expert opinion, but if by myself joining the conversation will help you, then I learn, and hopefully you get your answers faster!

    Good luck!


    Would someone please turn on the LIGHT?

    Thursday, April 11, 2013 9:57 PM
  • Assume the app is any of the current LS samples ...e.g. the Course Manager app.  I want to prepopulate tables of related entities.  I'm looking for a general pattern. 


    Xpert Search Agents for Microsoft web sites: http://www.parallelspace.net/MicrodeX

    Thursday, April 11, 2013 11:23 PM
  • Hi Michael,

    If you want to statically load items, you can use the code behind options to find the Loaded or Initialized event and add them there.

    The other option is to point it to an existing DB that you have the values in already.

    Below is an article for loading data from Excel:

    How to Import Data from Excel

    LMK if those don't work for you.


    Thanks
    Pierson

    • Proposed as answer by Angie Xu Wednesday, April 24, 2013 8:41 AM
    Friday, April 12, 2013 3:41 AM
    Moderator
  • The C# Contoso Moving App has some custom code in it that is exactly what I'm looking for: http://code.msdn.microsoft.com/The-LightSwitch-Contoso-7e1081e0

    Michaek


    Xpert Search Agents for Microsoft web sites: http://www.parallelspace.net/MicrodeX

    Wednesday, April 24, 2013 12:42 PM
  • Glad you got it figured out!

    Would someone please turn on the LIGHT?

    Wednesday, April 24, 2013 1:16 PM