2

我注意到,在我引用的Ncv報表字段中沒有生成。以下是我收到的錯誤。此計數= 1的SqlParameterCollection的索引1無效

這是我的域看起來像和我收到的錯誤是無效索引1爲此Count = 1的SqlParameterCollection。

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); 
    } 
} 
+0

您應該閱讀索引0,因爲c#數組以0開頭 – DeveloperX

+1

索引0?我不知道索引1甚至是什麼。 –

+0

我們可以在這方面得到賞金嗎? –

回答

1

好了,問題是,在

public class Ncv : Report 

我叫我的映射參考相同的名稱作爲類「報告」

public virtual Document Report { get; set; } 

所以不姓與你的財產與班級同名。它打破了CreateSchema

相關問題