locked
Repairing an application RRS feed

  • Question

  • I have an application I ‘may’ have to completely rebuild in order for it to be able to connect to the database it was designed for by LS. I am familiar a little with adding objects manually in visual studio pro and wondered if I can save myself some time by copying the code inside of all of my previous project files into new tables and screens for LS to generate a new database. One of the hardest things for me if I cannot do this is I do not remember what types of screens were used for all of the screens I made, and I modified the layout a lot so they don't always look just like the original templates. I also have some tables that have a lot of properties with a lot of their own properties like modified names since camel casing alone was not enough to keep the names divided since I also used number characters to keep the names short and so on. Long story short I wondered how much I could build manually by inserting objects and updating the code in the objects. Things like relationships and business logic will be easy to fix by observing the model outside of the debugger. Which is another reason looking at the screen type is hard since the debugger will not run on this project right now as it stands. Even if you know of a way to identify the screen types used in my code I can probably then go in table by table and make each property one at a time to match and make each screen to match and add the all the user code in to match I am just trying to save myself some time.
    Saturday, April 27, 2013 4:38 PM

Answers

  • When you use the Add Screen Wizard to add screens, a number of "templates" are provided to allow you to quickly create a particular "type" of screen (which can then be customised as required). But after screen generation, there is no actual "screen type". The provided templates simply add a pre-defined number of control to a screen, optionally with code as well.

    Any of the screen "types" can be constructed entirely manually, or one "type" of screen can later be changed from say a "search" screen to a "detail", simply by deleting unwanted controls/code & adding new one.

    Does that make sense?


    Yann Duran
         - Co-Author of Pro Visual Studio LightSwitch 2011
         - Author of the  LightSwitch Central Blog

    FREE Download: Luminous Tools for LightSwitch
    (a Visual Studio productivity extension for LightSwitch)
     
    Click Mark as Answer, if someone's reply answers your question
    Click  Vote as Helpful, if someone's reply is helpful
     
    By doing this you'll help everyone find answers faster.

    • Marked as answer by reigh7 Wednesday, May 1, 2013 5:00 PM
    • Unmarked as answer by reigh7 Wednesday, May 1, 2013 5:07 PM
    • Marked as answer by reigh7 Wednesday, May 1, 2013 5:12 PM
    Tuesday, April 30, 2013 12:46 PM
    Moderator

All replies

  • I have an application I ‘may’ have to completely rebuild in order for it to be able to connect to the database it was designed for by LS. I am familiar a little with adding objects manually in visual studio pro and wondered if I can save myself some time by copying the code inside of all of my previous project files into new tables and screens for LS to generate a new database. One of the hardest things for me if I cannot do this is I do not remember what types of screens were used for all of the screens I made, and I modified the layout a lot so they don't always look just like the original templates. I also have some tables that have a lot of properties with a lot of their own properties like modified names since camel casing alone was not enough to keep the names divided since I also used number characters to keep the names short and so on. Long story short I wondered how much I could build manually by inserting objects and updating the code in the objects. Things like relationships and business logic will be easy to fix by observing the model outside of the debugger. Which is another reason looking at the screen type is hard since the debugger will not run on this project right now as it stands. Even if you know of a way to identify the screen types used in my code I can probably then go in table by table and make each property one at a time to match and make each screen to match and add the all the user code in to match I am just trying to save myself some time.

    • Merged by Angie Xu Tuesday, May 7, 2013 1:15 AM the same post
    Saturday, April 27, 2013 4:24 PM
  • Sorry for the double post the browser did not submit the information so I resubmited it.
    Saturday, April 27, 2013 4:48 PM
  • Hi,

    I'm a little bit unclear on the scenario you're trying to achieve, so sorry if I have more questions than answers.

    I have an application I ‘may’ have to completely rebuild in order for it to be able to connect to the database it was designed for by LS.

    How many LightSwitch applications are you working on? Are you creating your application database using LightSwitch (adding new Entities/Tables and letting LightSwitch build the database) or attaching to an existing database with LightSwitch?

    I am familiar a little with adding objects manually in visual studio pro and wondered if I can save myself some time by copying the code inside of all of my previous project files into new tables and screens for LS to generate a new database.

    All LightSwitch Entities and Screens information is stored in .LSML files under Properties folder. Technically speaking you can copy the information in these LSML files into a different LightSwitch project, but it's very error prone. If you're trying to duplicate the database created by LightSwitch and modify it, it may be faster to copy your LightSwitch project into another LightSwitch project, delete all the existing screens and modify the schema from there.

    I also have some tables that have a lot of properties with a lot of their own properties like modified names since camel casing alone was not enough to keep the names divided since I also used number characters to keep the names short and so on.

    This leads me to believe that you're attaching to an existing database? If you're attaching to an existing database and the database's schema was changed, you can right click on the Data Source in Solution Explorer and invoke 'Refresh Data Source'. That will update your attached Data Source with the latest schema.

    Which is another reason looking at the screen type is hard since the debugger will not run on this project right now as it stands. Even if you know of a way to identify the screen types used in my code I can probably then go in table by table and make each property one at a time to match and make each screen to match and add the all the user code in to match I am just trying to save myself some time.

    I'm kinda lost here :) You don't actually need to run the code to know something is wrong with the screen type. The screen type is usually the class name.

    • Any invalid model information should result in a Warning in the Error window.
    • Any invalid user code should result in a build error that you can fix.

    If you can list more details on your scenario hopefully I can give better answers.

    Best regards,
    Huy


    Tuesday, April 30, 2013 4:39 AM
  • How many LightSwitch applications are you working on? Are you creating your application database using LightSwitch (adding new Entities/Tables and letting LightSwitch build the database) or attaching to an existing database with LightSwitch?

    I was building one application. Lightwitch created the database. I am still working on that same application. Something happened that damaged the database created. I can still open the project files as a single project but cannot run the debugger or publish the solution.

    All LightSwitch Entities and Screens information is stored in .LSML files under Properties folder. Technically speaking you can copy the information in these LSML files into a different LightSwitch project, but it's very error prone. If you're trying to duplicate the database created by LightSwitch and modify it, it may be faster to copy your LightSwitch project into another LightSwitch project, delete all the existing screens and modify the schema from there.

    What about the formatting I have done in the screen designer I printed out the whole 300+ pages of my main static code but did not see that? I am talking about creating all of the parts previously generated as if all I had was notepad and was naming extensions properly. In Visual Studio though some of that formatting of objects is done for me when I select the types of objects and models to create. So I hope to add them as such manually looking over and transferring code. Again I believe the problem to be the multiple folders created by the application to store data as a database not the applications code itself.

    This leads me to believe that you're attaching to an existing database? If you're attaching to an existing database and the database's schema was changed, you can right click on the Data Source in Solution Explorer and invoke 'Refresh Data Source'. That will update your attached Data Source with the latest schema.

    I am in no way attaching to an external database. That statement refers to the fact that in the designer the fields of each table are referred to as properties. Also in though the code for each property in the LSML uses the property tag to control that properties variables. This is also seen in the designer when you highlight a property and go into the property window for it in Visual Studio and modify these things like display name VS name when you created the property sio you can add spaces etc.. where the camel causing does not do that automatically.

    I'm kinda lost here :) You don't actually need to run the code to know something is wrong with the screen type. The screen type is usually the class name.

    • Any invalid model information should result in a Warning in the Error window.
    • Any invalid user code should result in a build error that you can fix.
    Actually I found that from experimentation that certain screens were set up to work with various capabilities and that even if you have the same controls they don't always work the same. Similarly some controls (object type control) are not available in certain screen types.
    Tuesday, April 30, 2013 7:26 AM
  • When you use the Add Screen Wizard to add screens, a number of "templates" are provided to allow you to quickly create a particular "type" of screen (which can then be customised as required). But after screen generation, there is no actual "screen type". The provided templates simply add a pre-defined number of control to a screen, optionally with code as well.

    Any of the screen "types" can be constructed entirely manually, or one "type" of screen can later be changed from say a "search" screen to a "detail", simply by deleting unwanted controls/code & adding new one.

    Does that make sense?


    Yann Duran
         - Co-Author of Pro Visual Studio LightSwitch 2011
         - Author of the  LightSwitch Central Blog

    FREE Download: Luminous Tools for LightSwitch
    (a Visual Studio productivity extension for LightSwitch)
     
    Click Mark as Answer, if someone's reply answers your question
    Click  Vote as Helpful, if someone's reply is helpful
     
    By doing this you'll help everyone find answers faster.

    • Marked as answer by reigh7 Wednesday, May 1, 2013 5:00 PM
    • Unmarked as answer by reigh7 Wednesday, May 1, 2013 5:07 PM
    • Marked as answer by reigh7 Wednesday, May 1, 2013 5:12 PM
    Tuesday, April 30, 2013 12:46 PM
    Moderator