2013-02-18 73 views
0

在項目中,我有這樣的映射:Fluent映射失敗,出現「Could not determine type ...」異常。

public virtual string LicensePlate { get; set; } 

public VehicleMap() 
{ 
    Table("VEHICLE"); 

    Id(x => x.LicensePlate, "LICENSE_PLATE"); 
    ... 
} 

當我嘗試運行中產生MappingException的應用程序,並指定:

Could not determine type for: nononono.Vehicle, nononono.DataAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, for columns: NHibernate.Mapping.Column(LICENSE_PLATE) 

有人能指出我在哪裏,我做錯了?

我試過將Id設置爲.NotNullable,.GeneratedBy.Assigned()並沒有任何幫助。

+0

您可以更改ID到別的東西?我懷疑這個錯誤是其他的,除了這個會顯示 – Firo 2013-02-18 19:15:07

+0

你能發佈你的'Vehicle.cs'文件嗎? – rae1 2013-02-19 05:01:50

+0

謝謝@ rae1n,錯誤出現在'Vehicle.cs'文件中。 – graffitiMSX 2013-02-19 13:01:05

回答

2

解決了這個問題,它是在另一個正在使用實體的類上。

而不是

public virtual Vehicle VehicleLicensePlate{ get; set; } 

我改

public virtual string VehicleLicensePlate{ get; set; } 
+1

我發現非常有幫助,這個id列的錯誤是由其他一些類錯誤地引用這個類引起的。這意味着這個類沒有錯誤。 – deafsheep 2013-10-09 20:32:27

相關問題