我試圖在11g中映射的Oracle表到這個類:功能NHibernate異常:從表中X的關聯是指未映射類:System.String
public class AdminTest
{
public virtual int Id { get; set; }
public virtual string PlayerName { get; set; }
public virtual string ClassYear { get; set; }
public virtual char IsMinor { get; set; }
public virtual char HasPaid { get; set; }
public virtual string Sport { get; set; }
public virtual string YearRegistered{ get; set; }
public virtual string SemesterChooseSport { get; set; }
public virtual char IsCaptain { get; set; }
public virtual string PlayerBuUsername { get; set; }
}
這流利的映射:
public class AdminTestMap: ClassMap<AdminTest>
{
public AdminTestMap()
{
//id is the primary key of the table
Table("tbl_117_admintest");
Id(x => x.Id).GeneratedBy.Sequence("seq_117_admintest");
References(x=>x.PlayerName).Column("player_name");
References(x=>x.ClassYear).Column("class_year");
References(x=>x.IsMinor).Column("isMinor");
References(x=>x.HasPaid).Column("hasPaid");
References(x=>x.Sport).Column("sport");
References(x=>x.YearRegistered).Column("year_registered");
References(x=>x.SemesterChooseSport).Column("semester_choose_sport");
References(x=>x.IsCaptain).Column("isCaptain");
References(x=>x.PlayerBuUsername).Column("playerBUUsername");
}
}
具有這種配置: 公共靜態ISessionFactory CreateSessionFactory() {
var cfg = OracleClientConfiguration.Oracle10
.ConnectionString(c =>
c.Is("connstr"));
return Fluently.Configure()
.Database(cfg)
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>().ExportTo(@".\"))
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();
}
我已經看過了幫助這三個環節: http://www.patternwebsolutions.com/2011/07/10/connect-to-oracle-using-fluentnhibernate/ Fluent NHibernate 3 and Oracle.DataAccess http://www.nullskull.com/q/10226070/fluent-nhibernate-configuration-for-oracle-11g.aspx
,我還沒有與上述消除異常任何運氣:從表中tbl_117_admintest的關聯是指未映射類:系統。串。我引用VS13中的Oracle.DataAccess.dll。 任何方向將不勝感激。
這似乎解決了爲什麼我收到該錯誤消息。現在我收到以下異常:{「嘗試加載Oracle客戶端庫引發BadImageFormatException。在安裝了32位Oracle客戶端組件的64位模式下運行時,會發生此問題。」}我將不得不提出另一個問題 – miniscem 2014-09-19 14:38:59