SourceColumnName in Adapter Model

Posts   
 
    
hommels
User
Posts: 23
Joined: 01-Jul-2005
# Posted on: 05-Jul-2005 17:15:17   

SourceColumnName does not exist in Adapter model

private EntityBase2 _EnterpriseEntity = null;

for ( int i=0; i<_EnterpriseEntity.Fields.Count; i++ ) { if ( ( _EnterpriseEntity.Fields[i].SourceColumnName != "PERSON_ID" ) && (
_EnterpriseEntity.Fields[i].SourceColumnName != "WEB_APPLICATION_ID" ) ) { _EnterpriseEntity.Fields[i].CurrentValue = _EnterprisePrefs [_EnterpriseEntity.Fields[i].SourceColumnName]; } }

jeffreygg
User
Posts: 805
Joined: 26-Oct-2003
# Posted on: 05-Jul-2005 19:16:27   

hommels wrote:

SourceColumnName does not exist in Adapter model


private EntityBase2 _EnterpriseEntity = null;

for ( int i=0; i<_EnterpriseEntity.Fields.Count; i++ ) 
{
           if ( ( _EnterpriseEntity.Fields[i].SourceColumnName != "PERSON_ID" ) && (  
                 _EnterpriseEntity.Fields[i].SourceColumnName != "WEB_APPLICATION_ID" ) )
           {
    _EnterpriseEntity.Fields[i].CurrentValue = _EnterprisePrefs 
                         [_EnterpriseEntity.Fields[i].SourceColumnName];
           }
}

I could be wrong on this one, but I believe that that information is not accessible from within the entity itself. The reason is that the persistence information (source table, column, etc) is abstracted from the entity itself. You'll find methods of accessing that information within the DataAccessAdapter in the DatabaseSpecific project of the generated code. Check the PersistenceInfoFactory class.

I am curious, however, why access to the column name is required instead of using the entity's property name? You can use _EnterpriseEntity.Fields["PERSON_ID"] instead of attempting to reference the column name, or better, _EnterpriseEntity.Person_ID.

Jeff...

hommels
User
Posts: 23
Joined: 01-Jul-2005
# Posted on: 05-Jul-2005 19:44:31   

i need to get at a specific (i from the index)sourcename property from the collection

jeffreygg
User
Posts: 805
Joined: 26-Oct-2003
# Posted on: 05-Jul-2005 20:47:49   

hommels wrote:

i need to get at a specific (i from the index)sourcename property from the collection

Well, assuming the generated property name wasn't changed from the original column name in the Designer, you can use



_EnterpriseEntity.Fields[i].Name


Jeff...

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 05-Jul-2005 20:50:22   

Hommels, you're trying to use adapter with selfservicing code. That won't work. Either use Selfservicing code or use adapter. Adapter has a different design pattern, that's why there are two different paradigms provided.

Frans Bouma | Lead developer LLBLGen Pro