SelfService and different database names

Posts   
 
    
BrianW
User
Posts: 17
Joined: 26-Sep-2005
# Posted on: 22-Sep-2007 22:08:29   

I've converted my Adapter based entities to use the SelfService entities. I always have two databases. The development database where everyone works and a local database for unit tests. The name of these databases are different and I've always used the config files to point to the correct server and database.

After switching to SelfService I'm getting an error saying it can't find the tables when I run from my local database (name is different from the database I generated) Is there a way around this or am I missing another config that is specific to SelfService?

Posts: 254
Joined: 16-Nov-2006
# Posted on: 22-Sep-2007 23:54:13   

I've converted my Adapter based entities to use the SelfService entities

Can you explain this further please? Are you saying you have changed your adapter entities to call the same entity in a separate assembly which is generated using the Self Servicing model?

What specific exception are you getting raised related to the missing table error? ( Exception and call stack would be great )

BrianW
User
Posts: 17
Joined: 26-Sep-2005
# Posted on: 23-Sep-2007 03:38:26   

I have the following Databases that have the same schema

GCLUnitTest  
GCLDevelopmentV1_0_9

I generated the code by refreshing against the GCLDevelopmentV1_0_9 database.

I run my unit tests against the GCLUnitTest database. I change the catalog name by using unit test config files. When I run I get the following error:

Initialization method Payjr.GCL.Test.ProductTest.MyTestInitialize threw exception. SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException:  SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryExecutionException: An exception was caught during the execution of an action query: Invalid object name 'GCLDevelopmentV1_0_9.dbo.OrderCart'.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception. --->  System.Data.SqlClient.SqlException: Invalid object name 'GCLDevelopmentV1_0_9.dbo.OrderCart'..

Stack Trace:

  at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at SD.LLBLGen.Pro.ORMSupportClasses.ActionQuery.Execute()
 --- End of inner exception stack trace ---
    at SD.LLBLGen.Pro.ORMSupportClasses.ActionQuery.Execute()
   at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.ExecuteActionQuery(IActionQuery queryToExecute, ITransaction containingTransaction)
   at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.DeleteMulti(ITransaction containingTransaction, IPredicate deleteFilter, IRelationCollection relations)
   at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase`1.DeleteMulti(IPredicate deleteFilter, IRelationCollection relations)
   at SD.LLBLGen.Pro.ORMSupportClasses.EntityCollectionBase`1.DeleteMulti(IPredicate deleteFilter)

I just converted my project over the using SelfService objects. (I no longer have the adapter classes in the project). When I run the unit tests using the adapter classes I'm able to use the different catalog name. When I run with the SelfServing it throws an exception. When I have the same catalog name as when it was generated it works fine. (GCLDevelopmentV1_0_9)

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Sep-2007 20:21:25   

How are you changing the catalog name at your config file? Are you using <sqlServerCatalogNameOverwrites>(LLBLGenPro Help - Using the generated code - Application configuration through .config files)?

David Elizondo | LLBLGen Support Team
BrianW
User
Posts: 17
Joined: 26-Sep-2005
# Posted on: 24-Sep-2007 00:25:34   

Here is the config settings. Without changing the config file it works using the adapter classes but does not work in SelfServing

    <add key="SQLConnection" value="data source=(local);initial catalog=GCLDevelopmentV1_0_9;integrated security=SSPI;persist security info=False;packet size=4096" />
    <add key="CatalogNameUsageSetting" value="1" />
    <add key="CatalogNameToUse" value="GCLDevelopmentV1_0_9" />
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 24-Sep-2007 08:54:56   

Are u using LLBLGenPro v2.0 or higher?

The catalog name overwriting shouldn't be like this?:

<configSections>
    <section name="sqlServerCatalogNameOverwrites" type="System.Configuration.NameValueSectionHandler" />
</configSections>

<sqlServerCatalogNameOverwrites>
    <add key="GCLDevelopmentV1_0_9" value="GCLUnitTest" />
</sqlServerCatalogNameOverwrites>

(Ref: LLBLGenPro Help - Using generated code - Application configuration through .config files - Catalog name overwriting (SqlServer, Sybase ASE)

David Elizondo | LLBLGen Support Team
gizmo
User
Posts: 3
Joined: 25-Aug-2007
# Posted on: 11-Oct-2007 12:48:02   

we used LLBLGen V1 (self-serving concurrency model) in an application that would prompt the user for which server and DB they wanted to attach to while the application is running.

please let me know if this is no longer supported with V2. if it is please point to or provide a code sample.

is it supported using adapters? sample code for this?

Thank you!

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 11-Oct-2007 13:00:52   

Please don't use old threads. Open a new thread please. (Guidelines: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=7725)