views:

13

answers:

0

I am tring to define a one to one relation between 2 tables using active record. I have a table Device and a table DeviceLocation. This is the code I use in DeviceLocation to define the relation:

[PrimaryKey(PrimaryKeyType.Foreign)]
        public int DeviceID
        {
            get { return _deviceID; }
            set { _deviceID = value; }
        }

        [OneToOne]
        public Device Device
        {
            get { return _device; }
            set { _device = value; }
        }

This isn't working. I am new to active record so I'm probably not doing it right. Can anyone help me?