0
我买设计下面的模式:实体框架定义在DB的上下文表
public class LogModel
{
public class UserActivityLogs
{
[Key]
public int id { get; set; }
//Id of the user
public string userId { get; set; }
//Time of the log
public DateTime time { get; set; }
public LogActions action { get; set; }
}
// Types of actions to log
public class LogActions
{
[Key]
public int id { get; set; }
public string name { get; set; }
public string description { get; set; }
}
}
现在我想知道什么是我需要在上下文中添加表Logactions
以及UserActivityLogs
或EF会看到这两个表已链接并自动创建log action
表?
也有我指定我的关系正确吗?我的目标是我可以定义多种类型的Logaction,然后用户日志将有一个与之关联的单个日志操作。