Hello guys.
I'm using Fluent NHibernate with SharpArch and everything was working
fine on tests.
After some library changes I started to have errors on all my data
access tests.
I'm pretty sure is about the mappings, but I dont know why it was
working and now its not.
Maybe you can give me some advices. Here is the exception thrown on
tests:
System.Reflection.TargetInvocationException : Exception has been
thrown by the target of an invocation.
----> System.MissingMethodException : Method not found:
'FluentNHibernate.Mapping.OneToOnePart`1<!!0>
FluentNHibernate.Mapping.ClassMapBase`1.HasOne
(System.Linq.Expressions.Expression`1<System.Func`2<!0,!!0>>)'.
TearDown : System.Reflection.TargetInvocationException : Exception has
been thrown by the target of an invocation.
----> System.NullReferenceException : Object reference not set to an
instance of an object.
Here's my one-to-one mapping:
public class LoginInfoMap : ClassMap<LoginInfo>
{
public LoginInfoMap()
{
WithTable("LoginInfo");
Id(x => x.ID, "ID")
.GeneratedBy.Foreign("Person");
LazyLoad();
Map(x => x.UserName)
.CanNotBeNull();
Map(x => x.UserPassword)
.CanNotBeNull();
Map(x => x.Salt)
.CanNotBeNull();
References(x => x.Person)
.WithUniqueConstraint()
.TheColumnNameIs("Id")
.LazyLoad()
.Cascade.None();
}
}
public PersonMap()
{
WithTable("Person");
Id(x => x.ID, "Id")
.WithUnsavedValue(0)
.GeneratedBy.Sequence("HIBERNATE_SEQUENCE");
Map(x => x.FirstName, "FirstName")
.CanNotBeNull();
Map(x => x.LastName, "LastName");
Map(x => x.CreatedDate).ValueIsAutoNumber();
DiscriminateSubClassesOnColumn("PersonType", (Int16)
(PersonType.Person))
.SubClass<Customer>()
.IsIdentifiedBy((Int16)(PersonType.Customer))
.MapSubClassColumns(m =>
{
//Map subclass columns here.
})
.SubClass<Employee>()
.IsIdentifiedBy((Int16)(PersonType.Employee))
.MapSubClassColumns(m =>
{
//Map subclass columns here.
});
HasOne(x => x.Login)
.PropertyRef(p => p.Person)
.Cascade.All()
.FetchType.Join();
HasMany<Contact>(person => person.Contacts)
.WithTableName("Contact")
.WithKeyColumn("Per_Id")
.Component(ct =>
{
ct.Map(c => c.Type, "ContactType")
.CustomTypeIs(typeof (ContactType))
.CustomSqlTypeIs("short");
ct.Map(c => c.Description, "Description")
.CanNotBeNull();
}).AsSet();
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---