views:

113

answers:

1

Using SubSonic 2.2, after DAL generation with sonic.exe, the AllStruct.cs content looks wrong:

// <auto-generated />
namespace ...DAL
{
  #region Tables Struct
  public partial struct Tables
  { ... }

  #endregion

    #region Schemas
    public partial class Schemas
    { ... }
    #endregion

    #region View Struct
    public partial struct Views 
    { ... }
    #endregion

    #region Query Factories
  public static partial class DB
  { ... }
    #endregion

}
#region Databases
public partial struct Databases 
{ ... }
#endregion

Is there any reason for placing the Databases region outside the namespace? If not, how can I correct it (I didn't find any templates for the generated code)?

+2  A: 

SubSonic Databases are analagous to providers. Each provider generates it's own namespace, so it's fitting that the Databases struct is outside of any generated namespace. If you configure multiple providers, your AllStructs.cs file will have multiple namespaces, each with it's own set of structs like the ones you posted.

The template generation file can be found here

ranomore
It makes sense now, thank you. How can I use sonic.exe with multiple providers? Must I use separate folders for each provider?
alexandrul
I'd ask that as a new question -- you'll get some great responses, I'm sure. But yes, each provider ends up in it's own folder.
ranomore
Very clear on the design statement. But it can be difficult to work with. I see a provider as schema + connection. Create one set of schema classes to be shared among as many connections as required. It's hard to make subsonic do it my way.
P a u l