SQL Azure & multiple schemas

Posts   
 
    
Posts: 10
Joined: 05-Mar-2013
# Posted on: 28-Aug-2013 10:11:28   

We are checking if SQL Azure is possible for hosting our application. In the documentation I'm reading about the SQL Azure support (see quote below). I use schemas to seperate groups of tables. For example for the seperation of default application tables and the customer specific tables.

Is there a way to use mixed schemas in a single project while being hosted in a SQL Azure database? I did not check the generated queries but what makes it that this will not work? SQL Azure supports schemas, LLBL generates queries with schema information...

SQL Azure support

LLBLGen Pro supports SQL Azure out of the box, at runtime. To make your application run on SQL Azure you have to do the following:

  • Use Catalog name overwriting to overwrite your catalog's name to "". See Catalog Name Overwriting in application config files for details how to do this. This works for Selfservicing and adapter. As 'old' catalog name you specify the name of the catalog you're using in the project, e.g. 'Northwind'. As 'new' catalog you specify the empty string: "".
  • Use only one catalog in your project. If you use multiple catalogs in your project, they'll be seen as one catalog on SQL Azure, as there's no catalog name allowed in SQL queries.
  • It's recommended to stick to the default schema 'dbo'. If you have used a different schema in your project and you use 'dbo' on SQL Azure, use Schema Name Overwriting (similar to catalog name overwriting) in your application's config file. If you want to use a different schema on SQL Azure, use ALTER USER username WITH DEFAULT_SCHEMA = schemaname; on the SQL Azure database to set it as the default schema.
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 29-Aug-2013 08:11:09   

If SqlAzure supports schemas, then it should work. You should work on your local DB first at LLBLGen Designer, then change the connection string at your generated code. In the early days of Azure it didn't support multiples schemas, so I didn't try it yet, but I think that it should work.

David Elizondo | LLBLGen Support Team
Posts: 10
Joined: 05-Mar-2013
# Posted on: 29-Aug-2013 11:48:40   

Thanks for the answer. To make sure; I did create a test and it does work. The LLBL documentation might need some updates on this one.

Steps to create test:

  • Created custom scheme; authorization on [dbo] scheme
  • Creates table (A) in dbo scheme
  • Created table (B) in custom scheme
  • Created testdata

  • Started LLBL Designer (2.6)

  • Added created tables as entities
  • Added created tables as typedlist (AB)

Created unittests - Fetch entity A - Fetch entity B - Fetch collection A - Fetch collection B - Fetch typedlist AB

All tests run fine on local SQL2008R2 and remote Azure.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39888
Joined: 17-Aug-2003
# Posted on: 29-Aug-2013 17:41:34   

Indeed, the docs are from before ScottGu took over Azure, i.e. when it was still a mess. Schemas did work then too, but only when the user was known, so no 'aliased schemas': only when user X was known and associated with schema X it was allowed to use schema X.

We'll update the docs.

Frans Bouma | Lead developer LLBLGen Pro