locked
Property names not correct when publish to database RRS feed

  • Question

  • Hi,

    I'm trying to give every property a meaningful name but when I look into the database script I see this:

    CREATE TABLE [dbo].[Contacts] (
        [Id]                       INT            IDENTITY (1, 1) NOT NULL,
        [RowVersion]               TIMESTAMP      NOT NULL,
        [FirstName]                NVARCHAR (255) NULL,
        [LastName]                 NVARCHAR (255) NOT NULL,
        [Address]                  NVARCHAR (255) NULL,
        [Telephone]                NVARCHAR (255) NULL,
        [Mobile]                   NVARCHAR (255) NULL,
        [Fax]                      NVARCHAR (255) NULL,
        [Email]                    NVARCHAR (255) NULL,
        [Birthday]                 NVARCHAR (255) NULL,
        [Contact_Country]          INT            NULL,
        [Contact_Language]         INT            NULL,
        [Supplier_Contact]         INT            NULL,
        [Retailstore_Contact]      INT            NULL,
        [Contact_City]             INT            NULL,
        [Contact_DeliveryAddress]  INT            NULL,
        [Contact_Customer1]        INT            NOT NULL,
        [Contact_FinancialAddress] INT            NULL
    ); 

    But when you look at the designer all names are correct:

    I think he would name the field Contact_Customer instead of Contact_Customer1...

    How can I change this in the designer?

    Friday, March 29, 2013 9:56 AM

Answers

  • So no solution for this? :(

    For what? You have been given an answer, you just don't like it.

    To repeat, if you use the LS designer to create your database, then you lose some control over it. If you want to have full control, you need to create your database externally, and connect to it from LS.

    So no, no solution. I thought I made that clear earlier.


    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    • Marked as answer by LaurentzT Thursday, April 11, 2013 8:13 AM
    Wednesday, April 10, 2013 1:55 PM

All replies

  • Same problem still no solution:

    Is there a way to set the name of the foreign key column in the underlying database scheme?

    This is very annoying because external programs needs to access this database...


    Friday, March 29, 2013 10:34 AM
  • As I commented there, if you are bothered about the naming, then don't create the database from within LS, create it externally and import it into LS. If you take the conveniences of LS creating the database, then you have to live with the inconveniences as well. If you create it externally (which is actually very little more effort) then you have full control, and can do what you like.

    Hope this helps.


    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    • Proposed as answer by Mr Yossu Friday, March 29, 2013 1:03 PM
    • Unproposed as answer by LaurentzT Friday, March 29, 2013 3:06 PM
    Friday, March 29, 2013 1:02 PM
  • Conveniences of placing a 1 after a field when us got 2 links...

    I'm now trying to override the service and common.lsml

     
    Friday, March 29, 2013 1:41 PM
  • What was it about my answer that you didn't like? You've made it clear that you want to access the database from an external application, and I pointed out that if you want fine control over the database, so that you know what will happen from that external application, then you need to create the database externally, not using the LS designer.

    I don't understand your last comments, so if my reply didn't answer your question, please explain why.


    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Saturday, March 30, 2013 11:31 PM
  • I already created the whole database + screen and just can't switch to a external database...

    It should be possible to change the name of the relation through the designer but that is not possible... So I just have to live withe the generated names

    Thursday, April 4, 2013 6:28 AM
  • So no solution for this? :(
    Wednesday, April 10, 2013 9:49 AM
  • So no solution for this? :(

    For what? You have been given an answer, you just don't like it.

    To repeat, if you use the LS designer to create your database, then you lose some control over it. If you want to have full control, you need to create your database externally, and connect to it from LS.

    So no, no solution. I thought I made that clear earlier.


    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    • Marked as answer by LaurentzT Thursday, April 11, 2013 8:13 AM
    Wednesday, April 10, 2013 1:55 PM
  • Ok I rest my case.. :) I just find it very annoying thats all... (especially for the other developers who are connecting to that database)
    Thursday, April 11, 2013 8:13 AM
  • Ok I rest my case.. :) I just find it very annoying thats all... (especially for the other developers who are connecting to that database)

    Well, you have to remember that the LS database designer wasn't intended for what you're doing. Like most of LS, it was designed to make life simple, for people who aren't developers. I think it's a fair assumption that if someone wants to use the same database externally, they would probably create it externally too. If Microsoft were to have given full control over the database from within LS, then they would basically have to have engineered most of the SQL Server management Studio inside Visual Studio. Apart from the knock-on effect that would have had on sales of SQL Server, it would have added a lot of complexity where it was not needed.

    I understand where you're coming from, and feel bad that you stumbled over this issue too late, but it was a reasonable decision on Microsoft's part, you were just unaware of the consequences.

    It is possible that you could attach to the database and create a script to recreate it, then run this on a new external database, clone your data across and then modify the LS app to connect to that instead of the intrinsic one, but it would be a fair bit of work, and possibly not worth the effort at this stage.


    FREE custom controls for Lightswitch! A collection of useful controls for Lightswitch developers. Download from the Visual Studio Gallery.

    If you're really bored, you could read about my experiments with .NET and some of Microsoft's newer technologies at http://dotnetwhatnot.pixata.co.uk/

    Thursday, April 11, 2013 1:26 PM