3
using System.ComponentModel.DataAnnotations;    

public class UserArmy
    {
        [Key, Column(Order = 1)]
        public Guid UserId { get; set; }
        [Key, Column(Order = 2)]
        public int UnitId { get; set; }
        public int Quantity { get; set; }
    }

Here is a model class I have. I'm using the Entity Framework, Code First approach. The [Key] attribute is recognised but not the Column(Order=x).

Am I missing something that needs to be included?

Thanks :)

1 Answer 1

4

You must add following namespace:

using System.ComponentModel.DataAnnotations.Schema;

http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.schema.aspx

Sign up to request clarification or add additional context in comments.

1 Comment

perfect thanks, I thought the thing I was 'using' would cover all I needed but they have to make it so complex! lol

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.