views:

63

answers:

1

When saving a row that has an integer primary key following exception is thrown in the VB version: 'Public member 'ChangeTypeTo' on type 'Decimal' not found.'

This happens in ActiveRecord.VB file :

Public Sub SetKeyValue(value As Object) Implements IActiveRecord.SetKeyValue 
    If value IsNot Nothing AndAlso value IsNot DBNull.Value Then 
        Dim settable = value.ChangeTypeTo(Of Integer)() '<<<<<<<<<<<<< in this line 

If I change the last line to:

 Dim settable = cInt(value)

This will fix the problem untill I have to recompile the T4 files again.

In the activeRecord.tt file the code for this line looks like this:

Dim settable = value.ChangeTypeTo(Of <#=tbl.PK.SysType#>)() 

How can I change this in the T4 file?

Thanks for your help.

gm

+1  A: 

Here is a link to the answer. I basically removed the VB templates and use the C# templates. It works.

http://stackoverflow.com/questions/2210119/casting-problem-in-subsonic-3/2234659#2234659

gm

gm