IsIdentity not defined

Apr 1, 2014 at 3:50 PM
I have successfully compiled the latest source code (ORM_1.0.14007_SRC).

When I try to compile the following code, I get the error: 'OpenNETCF.ORM.FieldAttribute' does not contain a definition for 'IsIdentity'

Everything else in the file compiles fine. What am I doing wrong? Thanks.
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using OpenNETCF.ORM;

namespace OpenNETCFDataLayer
{
    [Entity]
    public class Book
    {
        [Field(IsIdentity = true, IsPrimaryKey = true)]
        public int BookID { get; set; }

        [Field]
        public int AuthorID { get; set; }

        [Field]
        public string Title { get; set; }
    }
}
Coordinator
Apr 1, 2014 at 4:03 PM
Is this from the sample or test set? If so, it's incorrect (and I need to update it). You do not need to set a Field's IsIdentity (and can't as you've found). If you make it a PrimaryKey and then set the Entity's KeyScheme to Identity, the ORM can deduce that the field is an Identity. So it would look more like this:
    [Entity(KeyScheme = KeyScheme.Identity)]
    public class Book
    {
        [Field(IsPrimaryKey = true)]
        public int BookID { get; set; }

        [Field]
        public int AuthorID { get; set; }

        [Field]
        public string Title { get; set; }
    }
Marked as answer by BoroDrummer on 4/2/2014 at 5:56 AM
Apr 2, 2014 at 8:03 AM
My code is a simplified version of what you have in the Defining a Discoverable Entity section.

Thanks for the reply though. I should be able to get my test app working now.