How to Handle 3rd Party Tables, or New Tables after Code Generation

Posts   
 
    
ScottCate
User
Posts: 48
Joined: 11-May-2005
# Posted on: 05-Feb-2007 17:36:41   

Related Threads :: I'm not looking for DDL or Custom Fields, but they're related ideas.

Custom Fields http://llblgen.com/TinyForum/Messages.aspx?ThreadID=8636&HighLight=1

which points to

DDL at runtime with LLBLGen http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=8232

If I have generated LLBLGen code, and some time later, a new table is created, it would be great if LLBLGen could access it at runtime, without regenerating.

I'm not even caring about relations at this point, just generic access.

Something like...


EntityCollection genericEntities= new EntityCollection( new GenericTableFactory( "TableName" ) );
IPredicateRelationBucket filter = new PredicateRelationBucket();
/// setup filter
adapter.fetchCollection(genericEntities, filter, count);
foreach(GenericEntity genericEntity in genericEntities )
{
   string fieldValue1 = genericEntity.Fields["fieldValue1"];
   string fieldValue2 = genericEntity.Fields["fieldValue2"];
   string fieldValue3 = genericEntity.Fields["fieldValue3"];
   // do whatever else with the genericEntity using Fields Indexer
}

I'm pretty sure this isn't available today, but is it in the works, or even in the thoughts of the LLBLGen Architects?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 06-Feb-2007 10:41:46   

How would you map an entity CLASS, which doesn't exist to this new table at runtime? Isn't that impossible without emitting IL / compiling at runtime ?

Frans Bouma | Lead developer LLBLGen Pro
Backslash
User
Posts: 21
Joined: 21-Jun-2005
# Posted on: 08-Feb-2007 00:04:35   

What if LLBLGen Pro provided a special entity called something like DynamicEntity, which requires the table name as part of the constructor? Then it's just a matter of reading the table schema from the database, updaing the PersistenceInfoProvider, and adding the fields to the entity FieldsCollection. It should also be possible to cache the FieldsCollection for any new instances of DynamicEntity with the same table name, to keep overhead low.

I think this could work fine for very simple CRUD operations. It would be a bit more difficult to figure out relationships, prefetch paths, and so on.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 09-Feb-2007 12:46:43   

In theory it's doable, though the whole point is that you know up front that the entity is there. So we require you to take that into account. I know RoR supports this, but we've no plans on supporting this at this point.

Frans Bouma | Lead developer LLBLGen Pro