I have a situation where I need to have two databases and have a table in each that need to be related.
By the way, I read this thred and I am already on track... http://llblgen.com/tinyforum/Messages.aspx?ThreadID=2185&HighLight=1.
To explain better, there is an Image database. My application database basically just needs to associate images with Cases. So in the application database there is a table called CaseImage with a CaseId and ImageId. I made ImageId the primary key. It holds the primary key of the Image table in the Image database thus creating a 1:1 relationship.
So my first step was to include the Image catalog and add the ImageEntity to the LLBLGen project. Then I created a custom 1:1 relationship so that now, my CaseImageEntity will have a ImageEntity field.
Now, I'm thinking that this should all work great except for one exception:
My application is designed to connect to multiple databases. And what I mean by this is, different clients use the same application but access a completely different database based on the url they use to access the application. So for each client, there will be two connection strings saved in the web.config
for example, I could have the following connection strings:
Client1 connectionstring
Client2 connectionstring
Client3 connectionstring
Well, I had to do additional work to make this work because when I would assign the connection string to the DataAccessAdapter, it would not use the catalog name in the string. It would use the catalog name that was used to generate the code. So I used the following logic to make my adapter connect to the appropriate catalog:
adapter.CatalogNameUsageSetting = SD.LLBLGen.Pro.ORMSupportClasses.CatalogNameUsage.ForceName;
adapter.CatalogNameToUse = catalogName;
The catalogName was pulled from the connection string.
This worked just fine until this issue came up where I need to connect to the Image database. I want to Fetch my CaseImageEntity (from application catalog) and Prefetch the ImageEntity (from the image catalog). How do I specify the catalog name for different entities with a prefetch?
Or am I going to have to write my own logic to 'prefetch' the image data?