EntityType 'MyProfile' has no defined key. Define the key for this entity type


I am not sure why I am getting this error message. I have a primary key defined in my sql database for it. Here is my code:

    public ActionResult Register(RegisterModel model)
        if (ModelState.IsValid)
            // Attempt to register the user
            MembershipCreateStatus createStatus = MembershipService.CreateUser(model.UserName, model.Password, model.Email);

            if (createStatus == MembershipCreateStatus.Success)

                FormsService.SignIn(model.UserName, false /* createPersistentCookie */);
                MembershipUser myObject = Membership.GetUser();
                Guid UserID = (Guid)myObject.ProviderUserKey;
                MyProfile profile = new MyProfile();
                profile.Address = model.Address;
                profile.City = model.City;
                profile.Zip = model.Zip;
                profile.State = model.State;
                profile.UserId = UserID;
                return RedirectToAction("Index", "Home");
                ModelState.AddModelError("", AccountValidation.ErrorCodeToString(createStatus));

        // If we got this far, something failed, redisplay form
        ViewBag.PasswordLength = MembershipService.MinPasswordLength;
        return View(model);

And this is my MyProfile Class:

   namespace MatchGaming.Models
    [Bind(Exclude = "ProfileId")]
    public class MyProfile
        public int ProfileId { get; set; }

        public Guid UserId { get; set; }

        public string Address { get; set; }

        public string City { get; set; }

        public string Zip { get; set; }

        public string State { get; set; }


I am not sure why I am getting this error: EntityType 'MyProfile' has no key defined. Define the key for this EntityType. when it tries to add to the database db.Profiles.Add(profile);.

Which field is your key? Whichever it is - ProfileId or UserId - either change the name to MyProfileId or Id or else put a [Key] attribute on it.