First you need a method that returns the Field DBType (coz the timestamp .netType is byte[]). You need to extend the DataAccessAdapter class:
namespace yourProject.DatabaseSpecific
{
public class MyCustomAdapter : DataAccessAdapter
{
public IFieldPersistenceInfo getFieldDBType(IEntityField2 field)
{
return base.GetFieldPersistenceInfo(field);
}
}
}
Then your conversion code, would be (I think):
#region "Conversion Methods"
/// <summary>
/// Creates a new entity instance and copies over the values of this DTO
/// </summary>
public <[CurrentEntityName]>Entity ToEntity()
{
return ToEntity(new <[CurrentEntityName]>Entity());
}
/// <summary>
/// Copies over the values of this DTO into the entity passed in.
/// </summary>
public <[CurrentEntityName]>Entity ToEntity(<[CurrentEntityName]>Entity toFill)
{
<[Foreach EntityField CrLf]>
//--------------------------
IFieldPersistenceInfo fieldInfo = new MyCustomAdapter().getFieldDBType(<[EntityField]>);
// not timestamp (timestamp is enum 19 in SQLServer)
if (fieldInfo.SourceColumnDbType != 19)
{
toFill.<[EntityFieldName]> = _<[CaseCamel EntityFieldName]>;
}
//--------------------------
<[NextForeach]>
<[ If IsSubType ]> base.ToEntity(toFill);<[ EndIf]>
return toFill;
}
#endregion
No tested but should works. Let me know if you make it.