SourceColumnDbType in .lpt?

Posts   
 
    
veljkoz
User
Posts: 25
Joined: 31-Mar-2010
# Posted on: 23-Jul-2010 11:37:33   

Hi,

I'm using llbl v3.

In TDL template I found there's SourceColumnDbType that would return the fields database type it's mapped to.

How can I get this in a c# lpt template?

The code I'm using is something like this:

foreach (FieldElement field in entity.Fields)
{
    switch(field.??DbType??)
    {
          case "bigint": ....
          case "nvarchar": ......
    }
}

Thanks, Veljko

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 24-Jul-2010 06:59:09   

This is how I do that. Give it a try.

foreach (FieldElement field in entity.Fields)
{
    EntityMapping mapping =   (EntityMapping)currentProject.GetGroupableModelElementMapping(field.ContainingElement, _executingGenerator.DriverID);
    var fieldMapping = mapping.GetFieldMappingOfField(field);
    var targetField = fieldMapping.MappedTarget;

    switch(tgargetField.DbTypeAsString)
    {
         case "bigint": ....
         case "nvarchar": ......
    }
}
David Elizondo | LLBLGen Support Team
veljkoz
User
Posts: 25
Joined: 31-Mar-2010
# Posted on: 26-Jul-2010 15:23:33   

Thanks!