Table name from entity name

Posts   
 
    
fdb
User
Posts: 43
Joined: 01-Jul-2008
# Posted on: 13-Dec-2009 06:35:34   

Hi, I'm using LLBLGen v2.6, Adapter mode, LINQ, .NET 3.5 and Oracle 10g.

Is there any way to get the actual database table name from llblgen classes at runtime?

Regards, Farzad Badili

psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 13-Dec-2009 20:23:45   

This is a partial class we use that adds functionality to the DataAccessAdapter, exposing functionality to get the table and/or column name. It is generated as private or internal (I forget which).

using SD.LLBLGen.Pro.ORMSupportClasses;

namespace SearchObjects.DAL.DatabaseSpecific
{
    public partial class DataAccessAdapter : DataAccessAdapterBase
    {
        public string GetFieldName(IEntityField2 field)
        {
            IFieldPersistenceInfo i = GetFieldPersistenceInfo(field);
            return i.SourceColumnName;
        }
        public string GetTableName(IEntityField2 field)
        {
            IFieldPersistenceInfo i = GetFieldPersistenceInfo(field);
            return i.SourceObjectName;
        }
    }
}