Adapter & Name of Catalog

Posts   
 
    
Rainbow
User
Posts: 29
Joined: 23-Feb-2004
# Posted on: 20-Mar-2004 11:52:51   

Hi,

I've generated classes for a SQL 2000 DB With the Name of Rainbow (I'm using Adapter). Everything works o.k.

I've now tested it with a db of a different name (same tabls etc) but I'm getting the following error:

_Message: An exception was caught during the execution of a retrieval query: Invalid object name 'MyPharma.dbo.tidir_Directory'.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception. Source: SD.LLBLGen.Pro.ORMSupportClasses.NET11 TargetSite: System.Data.IDataReader Execute(System.Data.CommandBehavior) StackTrace: at SD.LLBLGen.Pro.ORMSupportClasses.RetrievalQuery.Execute(CommandBehavior behavior) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteMultiRowRetrievalQuery(IRetrievalQuery queryToExecute, IEntityFactory2 entityFactory, IEntityCollection2 collectionToFill, IFieldPersistenceInfo[] fieldsPersistenceInfo, Boolean allowDuplicates, IValidator validatorToUse) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection(IEntityCollection2 collectionToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection(IEntityCollection2 collectionToFill, IRelationPredicateBucket filterBucket) at TotalIngenuity.Module.Directory.Display..ctor() at ASP.Directory_ascx..ctor()

I know Adapter contains the name of the catalog in the code. And you can override that at runtime but I want it to be easily configurable via the web.config file so I've added the following:

<add key="Main.ConnectionString" value="data source=;initial catalog=MyPharma;User ID=;Password=***;persist security info=False;packet size=4096"/> <add key="CatalogNameUsageSetting" value="1"/> <add key="CatalogNameToUse" value="MyPharma" />

Do you know where I have gone wrong?

Thanks,

John

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 20-Mar-2004 12:05:01   

Is MyPharma.dbo.tidir_Directory a valid object in MyPharma? The name overwriting seems to work (MyPharma is now the catalog name as stated in the error).

Frans Bouma | Lead developer LLBLGen Pro
Rainbow
User
Posts: 29
Joined: 23-Feb-2004
# Posted on: 20-Mar-2004 17:54:51   

Otis wrote:

Is MyPharma.dbo.tidir_Directory a valid object in MyPharma? The name overwriting seems to work (MyPharma is now the catalog name as stated in the error).

Hi,

You should take the weekend off and relax wink you deserve it.

sorry my mistake....the table owner isn't dbo.Directory......the owner is the login account e.g. xyz ....so code is looking for MyPharma.dbo.Directory but the table is actually MyPharma.xyz.Directory.

In rainbow tables are generated without specifying dbo. as it allows the table to be created using the login account e.g. xyz (as there were some issues people had with hosts before when it was dbo.).

Is there anyway of fixing this via web.config?

Thanks,

John

Rainbow
User
Posts: 29
Joined: 23-Feb-2004
# Posted on: 20-Mar-2004 18:04:32   

Rainbow wrote:

Otis wrote:

Is MyPharma.dbo.tidir_Directory a valid object in MyPharma? The name overwriting seems to work (MyPharma is now the catalog name as stated in the error).

Hi,

You should take the weekend off and relax wink you deserve it.

sorry my mistake....the table owner isn't dbo.Directory......the owner is the login account e.g. xyz ....so code is looking for MyPharma.dbo.Directory but the table is actually MyPharma.xyz.Directory.

In rainbow tables are generated without specifying dbo. as it allows the table to be created using the login account e.g. xyz (as there were some issues people had with hosts before when it was dbo.).

Is there anyway of fixing this via web.config?

Thanks,

John

Hi,

update.......PersistenceInfoFactory.cs is where the Catalog Name is harcoded and the owner is coded e.g. new FieldPersistenceInfo("Rainbow", "dbo",

You can override Rainbow via the web.config as shown in my first post.....and I can modify the code to override dbo with e.g xyz via a web.config setting but this would be lost as soon as I regenerated the project so I was wondering if you could add this ability to llblgen by default?

Thanks,

John

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 22-Mar-2004 10:26:38   

You can derive from DataAccessAdapter and do the schema name overwriting overrides of GetFieldPersistenceInfos and GetFieldPersistenceInfo. First call the base class' method, then mangle the retieved info: set the schema name to a value read from the config file (once).

Frans Bouma | Lead developer LLBLGen Pro
bw
User
Posts: 6
Joined: 08-Mar-2004
# Posted on: 01-Apr-2004 20:49:48   

I have a similar problem--different schema owner between the development and production servers. What I'd like to do is just drop the schema name from the queries entirely. I could change all my field factories to use an empty string for the schema name, but SqlServerSpecificCreator always tries to include the schema--even if it's empty.

I see where the field names are built in SqlServerSpecificCreator, but is there any way for me to derive from this class and change the behavior? I can't see how I'd get my derived class to be used.

The best solution for me would be an option somewhere to tell it never to use the schema name; then I wouldn't have to modify all the generated factory classes.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 01-Apr-2004 23:16:57   

bw wrote:

I have a similar problem--different schema owner between the development and production servers. What I'd like to do is just drop the schema name from the queries entirely. I could change all my field factories to use an empty string for the schema name, but SqlServerSpecificCreator always tries to include the schema--even if it's empty. I see where the field names are built in SqlServerSpecificCreator, but is there any way for me to derive from this class and change the behavior? I can't see how I'd get my derived class to be used. The best solution for me would be an option somewhere to tell it never to use the schema name; then I wouldn't have to modify all the generated factory classes.

May I ask how you ended up with this? simple_smile The reason I ask is that normally people have their set of tables and other objects in the 'dbo' schema. Did you create the schema from a schema just for you and later it has to be migrated to 'dbo' ?

(just to get a clear view how some people develop their software so I can make changes which adapt that style of working with the tool).

A plugin system is in the works which will offer you to write a simple assembly which will change catalog info in the designer if you want.

The problems with Oracle are in: different schemas between development and production and problems with SqlServer are in (mostly): different catalog names between development and production.

Frans Bouma | Lead developer LLBLGen Pro
bw
User
Posts: 6
Joined: 08-Mar-2004
# Posted on: 02-Apr-2004 03:16:34   

Otis wrote:

May I ask how you ended up with this? simple_smile The reason I ask is that normally people have their set of tables and other objects in the 'dbo' schema. Did you create the schema from a schema just for you and later it has to be migrated to 'dbo' ?

On our in-house db servers everything is in dbo. However, the data classes are being deployed on a hosted web site, with a hosted (shared) SQL Server, where we're not the dbo, so on that server all the objects belong to a different login account. I could just redo the schema on the development server under a user account with the same name, but it seems easier to change the code to not use a schema name at all.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 02-Apr-2004 09:20:48   

bw wrote:

Otis wrote:

May I ask how you ended up with this? simple_smile The reason I ask is that normally people have their set of tables and other objects in the 'dbo' schema. Did you create the schema from a schema just for you and later it has to be migrated to 'dbo' ?

On our in-house db servers everything is in dbo. However, the data classes are being deployed on a hosted web site, with a hosted (shared) SQL Server, where we're not the dbo, so on that server all the objects belong to a different login account. I could just redo the schema on the development server under a user account with the same name, but it seems easier to change the code to not use a schema name at all.

Ok I see the point. What I'll add is a plugin system for the interpreter. This little plugin system can be configured from the generator configuration screen, and a little plugin can be one which renames schema X to Y and A to B or a catalog from A to B. This way it's flexible and others can write additional plugins.

Frans Bouma | Lead developer LLBLGen Pro
comradefry
User
Posts: 3
Joined: 23-Nov-2004
# Posted on: 23-Nov-2004 20:10:13   

Did this ever get built? If so, how is it used?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 23-Nov-2004 20:31:46   

comradefry wrote:

Did this ever get built? If so, how is it used?

It was postponed till a later date. Estimated release date: feb/march 2005

Frans Bouma | Lead developer LLBLGen Pro