This question was originally posted on Stackoverflow, I'm moving it here as per request.
Initial post:
We have a DB with multiple schemas with the same tables in the different schemas. Using LLBLGenPro to generate NHibernate entities. However, LLBLGenPro falls over, complaining that there are duplicate table names.
What we want is for the entities to be generated into namespaces per schema (got this working by modifying the templates), and for each schema to be generated into its own folder.
Follow-up:
(please post questions about llblgen pro on our own forums at http://www.llblgen.com/tinyforum so our support team can pick them up, thanks)
A DB with multiple schemas, you mean 1 catalog with multiple schemas (SQLServer) or multiple schemas as with Oracle?
Anyway, this is supported. What is the exact error you got and when? Do you use the latest build? If not, please download the latest build.
If you want to have entities grouped per target schema, you could group them in the project, and use the group in a custom template as a namespace.
You can also use the grouping mechanism in the designer to generate a vs.net project per group which is done in its own namespace and folder. The downside of this is that relationships between entities in different groups aren't supported of course, so in that case you have to duplicate the entities.
It's up to you what fits your project best.
Some clarification on what we're trying to do. Our Postgres DB has one catalog with three schemas (it has more, but I'll keep it simple for now). We initially operated in AsVisualGroupingMechanism mode, but then we had to duplicate a schema, and of course the entity names were then not unique. We also modified the entity/HBM generator templates to include the schema name in entities, but of course this doesn't get detected by the tool, which still says that there are duplicate entities.
So, we switched to ProjectPerGroup mode. I created two groups, A and B, with the entities from schemas 1 and 2 respectively. That worked fine. Schema 3 has only a few tables, which are interrelated amongst themselves, but not with any other schema. I added these entites to groups A and B, since the entities in both groups need access to the set of entities in schema 3. When I add the entities to group A, it works fine and all the relationships are detected. When I add them to group B, it adds the entities but it doesn't detect the relationships between them. I could re-add them manually, but there are lots, and I'd have to do it for every group after the first one, which would be extremely tedious. I tested whether the problem was affected by which group I chose to add schema 3 to, first, but it was not. Whichever group I added the entities to first, worked fine; all sunsequent ones do not detect the relationships.
So that's about it. We really just want a way for the tool to recognise that entities in different schemas are not the same entity. The above problem is as close as we could get.