1

I have created a functioning LightSwitch (Visual studio 2012 Pro) application... Now it's time to publish! The only problem is that I can't seem to figure out how to change the schema name to something other than dbo.

That is, I don't want the output tables to be dbo.XXXX, I want them to be my_schema.XXXX instead.

Also, note that the database is on SQL Server 2005.

Does anyone have suggestions on how to achieve this?

Thanks!

Update: Sorry for not being specific. I don't want to change the schema for existing tables in my database. I want my LightSwitch application to use the new schema. I don't mind publishing it and then modifying the schema on the tables, if I can then somehow also modify the LightSwitch application to use the new schema. But ideally, there would be a way to tell LightSwitch to use a different schema when it publishes.

For those who don't know what LightSwitch is, it is a Microsoft .Net Rapid Application Development tool for SilverLight business applications, and is built into Visual Studio 2012. My application is written in VB.Net

Omaer
  • 817
  • 1
  • 7
  • 22

1 Answers1

3

You can't change the schema name for an intrinsic database (the database that is created with LightSwitch). Maybe you'll be able to in V3, but you can't currently do it in V1 or V2. To achieve this, you'll have to create the database in something like SSMS (SQL Server Management Studio, then attach to it as an external data source.

Seeing as you've already done all the creating in LightSwitch, you could publish it as is, then attach to it as I mentioned above. I hope you don't have screens created, because unless you want to manually edit all of the lsml, you won't be able to use the attached database in any already created screens.

Any time you need to do something "out of the ordinary" with LightSwitch's database, you need to create it outside of LightSwitch, then attach to it. Why? LightSwitch was originally created with the idea in mind that the users didn't need to know anything about SQL Server.

Yann Duran
  • 3,842
  • 1
  • 24
  • 24
  • Thanks Yann... Does this mean that every one of my LightSwitch applications needs its own database? Also, if I am willing to manually modify a lot of the code, then where would I be able to do that? Logically, one would want all the database elements of a single app to be grouped under the same schema so it's odd that Microsoft doesn't support this out of the box... guess I'll have to slog it out this time. – Omaer Jul 17 '13 at 08:40
  • You asked "Does this mean that every one of my LightSwitch applications needs its own database?". No, a single database can be linked to from any number of LightSwitch applications. As for "it's odd that Microsoft doesn't support this out of the box", I explained that (LightSwitch was originally created with the idea in mind that the users didn't need to know anything about SQL Server). :-) LightSwitch has been taken up by an entirely different developer audience than what it was written for. Originally, simplicity was one of its most important tenets. – Yann Duran Jul 17 '13 at 13:24
  • When I said modify something, I was talking about the XML found in the application's Common.lsml file, found in the Common project. If you attempt to modify it, PLEASE make a backup of it first. It ony takes ONE small mistake & your entire project may not load until you find & fix it. – Yann Duran Jul 17 '13 at 13:28