2
votes

I am trying to map an oracle table in 11g to this class:

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; }
}

and this fluent mapping:

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");
        }
    }

with this configuration: public static 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();
    }

I have looked at these three links for help: 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

and I have not had any luck with eliminating the exception above: An association from the table tbl_117_admintest refers to an unmapped class: System.String. I am referencing the Oracle.DataAccess.dll in VS13. Any direction would be appreciated.

1

1 Answers

4
votes

I've not used fluent-nhibernate much but the hint seems to be the class the system is telling you it can't find a map for.

You would never map a string class. I think the problem is you are using

References(x=>x.PlayerName) to map all the properties, try using Map(x => x.PlayerName) instead.