views:

25

answers:

1

I just started exploring SubSonic 3's ActiveRecord, and it's initial code generation has created errors.

    Cannot implicitly convert type 'int?' to 'int'. 
    An explicit conversion exists (are you missing a cast?)


Here's the line it throws the exception on:

    public override int GetHashCode() {
        return this.pkEmp;
    }

The exception is understandable since the column pkEmp is defined as int? _pkEmp;. Any ideas on why the two are out of sync?

A: 

As John Sheehan pointed out, it's important to make sure that any primary keys are not nullable (and why would they be?).

Donald Hughes