Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> Hard coded database name
 

Pages: 1
Bugs & Issues
Hard coded database name
Page:1/1 

  Print all messages in this thread  
Poster Message
Dan1
User



Location:

Joined on:
20-Sep-2007 16:09:06
Posted:
41 posts
# Posted on: 07-Nov-2007 17:39:06.  
v2.5
I can change my connection string, but it seems that LLBLGen Pro generates code that hard codes the name of the database in the code. Is there a way around this? Here are some examples of where the database name is hardcoded:


Clearly I can change the connection string, but it still tried to use the database name that is generated (no matter which database I specify in my connection string).


        ''' <summary>Inits View's mappings</summary>
        Private Sub InitAssy_Info_ViewTypedViewMappings()
            MyBase.AddElementMapping( "Assy_Info_ViewTypedView", "WeldQA", "dbo", "vwAssy_Info", 15 )



        ''' <summary>
        ''' Calls stored procedure 'spInspectionsExist_WeldSpec_MigID'.<br/><br/>
        '''
        ''' </summary>
        ''' <param name="weldSpec_MigId">Input parameter of stored procedure</param>
        ''' <param name="inspectionsExist">InputOutput parameter of stored procedure</param>
        ''' <returns>Amount of rows affected, if the database / routine doesn't surpress rowcounting.</returns>
        Public Shared Function InspectionsExist_WeldSpec_MigId(weldSpec_MigId As System.Int32, ByRef inspectionsExist As System.Boolean) As Integer
            ' create parameters
            Dim parameters() As SqlParameter = New SqlParameter(2 - 1) {}
            parameters(0) = New SqlParameter("@WeldSpec_MigID", SqlDbType.Int, 0, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Current, weldSpec_MigId)
            parameters(1) = new SqlParameter("@InspectionsExist", SqlDbType.Bit, 0, ParameterDirection.InputOutput, True, 1, 0, "", DataRowVersion.Current, inspectionsExist)
            ' Call the stored proc.
            Dim toReturn As Integer = DbUtils.CallActionStoredProcedure("[WeldQA].[dbo].[spInspectionsExist_WeldSpec_MigID]", parameters, Nothing)
            If Not parameters(1).Value Is System.DBNull.Value Then
                inspectionsExist = CType(parameters(1).Value, System.Boolean)
            End If
            
            Return toReturn
        End Function
  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8138 posts
# Posted on: 08-Nov-2007 04:14:44.  
Indeed, LLBLGenPro uses the original catalog name at code. You can change the catalog name via config files.
Did you read LLBLGenPro Help - Using generated code - Application configuration through config files - Catalog name overwriting (SqlServer, Sybase ASE) ?


David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
Dan1
User



Location:

Joined on:
20-Sep-2007 16:09:06
Posted:
41 posts
# Posted on: 08-Nov-2007 14:43:43.  
Thanks!!!
  Top
j0shu@tree
User



Location:

Joined on:
07-Jul-2014 15:26:11
Posted:
8 posts
# Posted on: 18-Mar-2016 11:02:44.  
Found it..sorry...


But how would the .config file look??


Code:


<configSections>
    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
    
<configSections>
    <section name="ConnectionString.RIS" type="System.Configuration.NameValueSectionHandler" />
</configSections>

<sqlServerCatalogNameOverwrites>
    <add key="RIS001" value="RIS001Prod" />
</sqlServerCatalogNameOverwrites>


    </sectionGroup>
    
</configSections>
<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>

<appSettings>
    <add key="ConnectionString.RIS" value="data source=;initial catalog=RIS001;.."/>
    <add key="ClientSettingsProvider.ServiceUri" value="" />
</appSettings>




Jos


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
38047 posts
# Posted on: 18-Mar-2016 15:51:29.  
You add these elements to your application's app./web.config file, configSections at the top.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.