acradyn wrote:
That sounds like it might work. I'll modify the template for the DataAccessAdapter then override HandleCatalogName method. I assume I can use IFieldPersistenceInfo.SourceObjectName to get the name of the orginal entity and I'll have to keep my own meta data as to which entity goes with each catalog.
correct.
Is this called on every query for every entity? If so, this might work. Here's an example query that I need produced. (it's not real but shows my issue)
Yes, GetFieldPersistenceInfo* methods are called for every query. There's a special catalog name handler for stored procedures, which is called from teh stored procedure call code in the adapter. If you're not using procs, don't bother
Though, it's still a bit unclear to me if you want to overwrite one catalog name to a fixed different name, per running application, or per call.
There are scenarios where I would do both. My application can handle data access on the client or the application server. In the later case, I would need to override it on everycall, depending on who the user is.
Ok. If you need fixed name overwriting (so for this app A, you always have to overwrite the catalogname 'Foo' to 'Bar', please check the section 'Using the generated code -> Application configuration through .config files' which illustrates how to setup name overwriting in the config file for more than 1 catalog for example.
As long as were on the subject, how is the Multiple Catalog support supposed to work? Does it only work when the CatalogNameUsage.Default enum is used? Let's say I imported entities from 2 catalogs into my project, it appears that if any other enum value is used, the queries could look in the wrong catalog for some entities.
CatalogNameUsage was added to the adapter prior to the feature to support multiple catalogs in a project was added.
Normally, when you import 3 catalogs for example into your llblgen pro project, the code will just work on these 3 catalogs, transparently: you just use the single entity set.
This works because the catalog name is contained in the persistence info. If you want to target a different catalog for some of them, you have to use the .config settings to set up from-to name pairs. This isn't per call, but in almost all cases this is sufficient as name overwriting is required most of the time in situations where the development takes place on different catalogs than the production database uses.