我使用EF6。我有一个<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<meta charset='utf-8'>
</head>
<body>
<div class="contentarea">
<div class="camera">
<video id="video">Video stream not available.</video>
<button id="startbutton">Take photo</button>
</div>
<canvas id="canvas">
</canvas>
<div class="output">
<img id="photo" alt="The screen capture will appear in this box.">
</div>
</div>
</body>
</html>
和一个Person
类:
Friend
我有两张桌子:
人
朋友
我希望EF public class Person
{
public int Id { get; set; }
public string Name { get; set; }
public Friend { get; set; }
}
public class Friend
{
public int Id { get; set; }
public string Name { get; set; }
}
将DBContext
列与FriendId
类中的Friend
对象进行映射。
创建Person
实例时,我希望EF创建Person
个实例,并在Friend
列中设置FriendId
。
有可能还是我做错了?我是否必须将Person(FriendId)
属性替换为int Friend
?
谢谢