I'm trying to set a variable like so...
var userID = WebMatrix.WebData.WebSecurity.CurrentUserId;
var options = db.UserProfiles.Find(userID).TaskTypeSetting;
I'm using the user authentication table provided by the basic Internet Application template.
Row UserId in table UserProfile has a one-to-many relationship with row User in table TaskTypeSetting.
It is telling me that it cannot find a definition for TaskTypeSetting. Shouldn't I be able to do this if my relationships are set up properly?
Here is the model for the table:
namespace DailyTaskList.Models
{
using System;
using System.Collections.Generic;
public partial class TaskTypeSetting
{
public int ID { get; set; }
public int Type { get; set; }
public int User { get; set; }
}
}
It looks like it's not adding the relationship to the code? The .edmx diagram shows the relationships as I have them set up.
Edit:
UserProfile class definition:
namespace DailyTaskList.Models
{
using System;
using System.Collections.Generic;
public partial class UserProfile
{
public int UserId { get; set; }
public string UserName { get; set; }
}
}
Compiler Error Message: CS1061: 'DailyTaskList.Models.UserProfile' does not contain a definition for 'TaskSetting' and no extension method 'TaskSetting' accepting a first argument of type 'DailyTaskList.Models.UserProfile' could be found (are you missing a using directive or an assembly reference?)
I'm also getting this under Mapping Details:
Mappings are not allowed for an association over exposed foreign keys.