小编Aff*_*fuu的帖子

Reflection.TargetInvocationException

我有一个名为carroms的课程.当我创建它的对象时,没有错误.但是当我创建一个carroms数组时,抛出了这个异常:

PresentationFramework.dll中出现未处理的"System.Reflection.TargetInvocationException"类型异常

附加信息:调用目标引发了异常.

我的carroms类代码:

class carroms
{

    private bool player;

    public bool checkPlayer
    {
        get { return player; }
        set { player = value; }
    }

    private Point center;

    public Point carromCenter
    {
        get { return center; }
        set { center = value; }
    }

    private Point[] points;

    public Point[] carromPoints
    {
        get { return points; }
        set { points = value; }
    }

    private double width;

    public double carromWidth
    {
        get { return …
Run Code Online (Sandbox Code Playgroud)

c# wpf exception-handling exception

5
推荐指数
2
解决办法
3万
查看次数

实体类型没有键定义的EF6

这是我的代码,虽然我已经改进了关键属性,但仍然存在问题.

public class Contacts
{
    [Key]
    public int ContactId { get; set; }
    public string Name { get; set; }
    public string Address { get; set; }
    public string City { get; set; }
    public string State { get; set; }
    public string Zip { get; set; }
    [DataType(DataType.EmailAddress)]
    public string Email { get; set; }
}
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

实体类型"联系人"没有定义键.定义此实体类型的键.
实体类型:EntitySet"联系人"基于未定义键的"联系人"类型

entity-framework models asp.net-mvc-5

5
推荐指数
1
解决办法
2万
查看次数