[FluentNHibernate.Cfg.FluentConfigurationException] = "An invalid or
incomplete configuration was used while creating a SessionFactory. Check
PotentialReasons collection, and InnerException for more detail."
Classes:
public class Person
{
public Person()
{
CreatedAt = DateTime.Now;
}
public virtual int Id { get; protected set; }
public virtual DateTime CreatedAt { get; protected set; }
public virtual string FirstName { get; set; }
public virtual string LastName { get; set; }
public virtual string FullName
{
get { return string.Concat(FirstName, " ", LastName); }
}
}
public class Contact : Person
{
public Contact()
{
Address = new Address();
}
public virtual string Email { get; set; }
public virtual string Mobile { get; set; }
public virtual string Phone { get; set; }
public virtual Address Address { get; set; }
public virtual ContactType ContactType { get; set; }
}
public class Address
{
public virtual string StreetOne { get; set; }
public virtual string StreetTwo { get; set; }
public virtual string City { get; set; }
public virtual string Zip { get; set; }
public virtual string Country { get; set; }
}
Then I tried to automap the Address class as a component with the following
but it gives the above exception. I just love breaking things :)
FluentConfiguration fluentConfig = Fluently.Configure()
.Database(SQLiteConfiguration.Standard.UsingFile(PathToSqlLiteDb))
.Mappings(m =>
m.AutoMappings.Add(AutoPersistenceModel.MapEntitiesFromAssemblyOf<Club>()
.WithSetup(s =>
{
s.IsComponentType =
type => type == typeof
(Address);
s.GetComponentColumnPrefix =
property => property.Name +
"_";
})).ExportTo("D:\\"));
Configuration nhibConfig = fluentConfig.BuildConfiguration();
_sessionFactory = nhibConfig.BuildSessionFactory();
BuildSchema(nhibConfig);
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---