we have diff. databases outside our DNN db. example: ordering, warehouse. ect. I can add the connections in the web.conf. but how would I get the DataContext.Instance() to point to one of those db or can you not use this class method. we will be calling primarily Stored Procedures.
Public Shared Function GetEntry(ByVal entryId As Integer, ByVal moduleId As Integer) As ApplicationsInfo Dim entry As ApplicationsInfo
Using ctx As IDataContext = DataContext.Instance() Dim rep = ctx.GetRepository(Of ApplicationsInfo)() entry = rep.GetById(entryId, moduleId) End Using
Return entry End Function
thanks
Doug
There's an overload of DataContext.Instance that takes the connection string name.
DataContext.Instance
thanks for the quick reply and I see the fuction, but how would I code that?
Public Shared Function Instance() As IDataContext Public Shared Function Instance(connectionStringName As String) As IDataContext
DataContext.Instance("NewConnectionString") doesn't work.
I would expect DataContext.Instance("NewConnectionString") to work, what error are you getting?
DataContext.Instance("NewConnectionString")
I got it working. had to add ref. to PetaPoco.
thanks for your help
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.