Otis wrote:
I'll add it to the todo to add it to the properties to set when you start a generate action, so you can control last minute stuff.
Okay but this is not going to solve the problem since LLBLGen is often used to build "products" which are shipped as compiled assemblies. These assemblies will be deployed into a various environments each of which will have different configurations.
This is especially true when a product is ASP.NET based and is destined for small businesses whos web sites are hosted on shared ISP Servers. Each ISP puts different restrictions on their customers and often the ISP dictates catalog owner names for all the customers objects in the shared SQL Server.
This is the case I have experienced this week.
Otis wrote:
Having something in the config file is not that recommended I think, because it has to overwrite every time the name of the schema in the field.
Surely when you are building the dynamic SQL the catalog owner can also be inserted on the fly. The catalog owner name could be cached in memory since it's unlikely to change between application restarts, so reading the web.config need only happen once.
Additionally, there would also be the need to have the ability to specify catalog owner
on a per "per object" basis as is the case using the Designer today.
While I appreciate that this is not a trivial change, for me at least it is one of high importance....
So as a workaround, can you confirm the following:
Assuming I have set "dbo" in the Designer, I will replace all instances of "dbo" in PersistenceInfoFactory.cs and RetrievalProcedures.cs with a method for obtaining the catalog owner from the config file (assume I will implement a cache
).
Is there anything else I need to do?
[edit]
Actually it looks like if I replace "<[SourceSchemaName]>" in the adapter templates with a cache lookup base on some object name key. For instance
toReturn.AddFieldPersistenceInfo("<[EntityFieldName]>", new FieldPersistenceInfo("<[SourceCatalogName]>", "<[SourceSchemaName]>", "<[SourceObjectName]>", "<[SourceColumnName]>", <[SourceColumnIsNullable]>, (int)SqlDbType.<[SourceColumnDbType]>, <[SourceColumnMaxLength]>, <[SourceColumnScale]>, <[SourceColumnPrecision]>, <[IsIdentity]>, "<[IdentityValueSequenceName]>"));<[NextForeach]>
would become:
toReturn.AddFieldPersistenceInfo("<[EntityFieldName]>", new FieldPersistenceInfo("<[SourceCatalogName]>", SchemaNameCache["<[SourceObjectName]>"], "<[SourceObjectName]>", "<[SourceColumnName]>", <[SourceColumnIsNullable]>, (int)SqlDbType.<[SourceColumnDbType]>, <[SourceColumnMaxLength]>, <[SourceColumnScale]>, <[SourceColumnPrecision]>, <[IsIdentity]>, "<[IdentityValueSequenceName]>"));<[NextForeach]>
where SchemaNameCache["<[SourceObjectName]>"] would lookup the correct Schema name...
I do get your concerns about this having a performance overhead however...
[/edit]
Marcus