此 SqlParameterCollection 的索引 1 无效,且 Count=1

发布于 2024-12-11 08:20:17 字数 2104 浏览 0 评论 0原文

我注意到,在 Ncv 中,我引用的报告字段并未生成。以下是我收到的错误。

这是我的域的样子,我收到的错误是 Invalid index 1 for this SqlParameterCollection with Count=1。

public class NcvMap : SubclassMap<Ncv>
{
    public NcvMap()
    {
        HasManyToMany<Document>(x => x.Technician)
            .Cascade.All();

        HasManyToMany<Document>(x => x.Neurologist)
            .Cascade.All();

        HasManyToMany<Document>(x => x.Transcriber)
            .Cascade.All();

        References<Document>(x => x.Report).Nullable();
    }
}

public class Ncv : Report
{
    public virtual IList<Document> Technician { get; private set; }
    public virtual IList<Document> Neurologist { get; private set; }
    public virtual IList<Document> Transcriber { get; private set; }
    public virtual Document Report { get; set; }
    public virtual NcvType Type { get; set; }

    public Ncv()
    {
        this.Technician = new List<Document>();
        this.Neurologist = new List<Document>();
        this.Transcriber = new List<Document>();
    }
}

public class Report : BaseModel
{
    public virtual Patient Patient { get; set; }
    public virtual ReportStatus Status { get; set; }
    public virtual DateTime Appointment { get; set; }
    public virtual long Kareo_id { get; set; }
    public virtual IList<ReportLog> Logs { get; private set; }

    public Report() 
    {
        this.Status = ReportStatus.New;
        this.Logs = new List<ReportLog>();
    }

    public virtual void AddLog(ReportLog log)
    {
        log.Report = this;
        this.Logs.Add(log);
    }
}

public class ReportMap : ClassMap<Report>
{
    public ReportMap()
    {
        Id(x => x.Id);
        Map(x => x.CreateDate);
        Map(x => x.LastModified);
        Map(x => x.Appointment);
        Map(x => x.Status).CustomType<int>();
        Map(x => x.Kareo_id);

        HasMany<ReportLog>(x => x.Logs)
            .Cascade.All();

        References<Patient>(x => x.Patient);
    }
}

What I have noticed is that the in Ncv the Report field that i am referencing is not generated. Below is the error I am receiving.

Here is what my domain looks like and the error i receive is Invalid index 1 for this SqlParameterCollection with Count=1.

public class NcvMap : SubclassMap<Ncv>
{
    public NcvMap()
    {
        HasManyToMany<Document>(x => x.Technician)
            .Cascade.All();

        HasManyToMany<Document>(x => x.Neurologist)
            .Cascade.All();

        HasManyToMany<Document>(x => x.Transcriber)
            .Cascade.All();

        References<Document>(x => x.Report).Nullable();
    }
}

public class Ncv : Report
{
    public virtual IList<Document> Technician { get; private set; }
    public virtual IList<Document> Neurologist { get; private set; }
    public virtual IList<Document> Transcriber { get; private set; }
    public virtual Document Report { get; set; }
    public virtual NcvType Type { get; set; }

    public Ncv()
    {
        this.Technician = new List<Document>();
        this.Neurologist = new List<Document>();
        this.Transcriber = new List<Document>();
    }
}

public class Report : BaseModel
{
    public virtual Patient Patient { get; set; }
    public virtual ReportStatus Status { get; set; }
    public virtual DateTime Appointment { get; set; }
    public virtual long Kareo_id { get; set; }
    public virtual IList<ReportLog> Logs { get; private set; }

    public Report() 
    {
        this.Status = ReportStatus.New;
        this.Logs = new List<ReportLog>();
    }

    public virtual void AddLog(ReportLog log)
    {
        log.Report = this;
        this.Logs.Add(log);
    }
}

public class ReportMap : ClassMap<Report>
{
    public ReportMap()
    {
        Id(x => x.Id);
        Map(x => x.CreateDate);
        Map(x => x.LastModified);
        Map(x => x.Appointment);
        Map(x => x.Status).CustomType<int>();
        Map(x => x.Kareo_id);

        HasMany<ReportLog>(x => x.Logs)
            .Cascade.All();

        References<Patient>(x => x.Patient);
    }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

め七分饶幸 2024-12-18 08:20:17

好吧,问题是

public class Ncv : Report

我将映射引用命名为与类“Report”相同的名称,

public virtual Document Report { get; set; }

因此不要使用与类相同的名称来命名您的属性。它破坏了 CreateSchema

Ok the problem was that in

public class Ncv : Report

I named my mapped reference the same name as the class "Report"

public virtual Document Report { get; set; }

So don't name your property with the same name as the class. It breaks the CreateSchema

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文