Hi all,
Using Microsoft's designer for the Entity Framework (v3.5), I have created an Entity Model (*.edmx) with a generated *.Designer.cs class. I can persist my objects to MS SQL Server using the model without any problems.
I am new to NHibernate, and out of curiosity, I now would like to use my model with Fluent NHibernate and SQLite as database. I have read the Auto mapping article on the Fluent NHibernate wiki. I did adapt the Examples.FirstAutomappedProject
and have adapted the ExampleAutomappingConfiguration
to map my entities. (I used only the ShouldMap
and IsId
overrides). My entities are rather simple and do not contain explicit references to each other in the model.
Now, when I build the Session Factory, i get the following exception:
An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
with an inner exception with the message
An association from the table XXX refers to an unmapped class: System.Data.EntityKey
None of my entities' properties are of type System.Data.EntityKey
.
[global::System.Data.Objects.DataClasses.EdmEntityTypeAttribute(NamespaceName="MyStorageModel", Name="XXX")]
[global::System.Runtime.Serialization.DataContractAttribute(IsReference=true)]
[global::System.Serializable()]
public partial class XXX: global::System.Data.Objects.DataClasses.EntityObject
{
//...
[global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
[global::System.Runtime.Serialization.DataMemberAttribute()]
public global::System.Guid XXXID
{
//...
}
//...
}
As you see, my entity classes are heavily decorated (by the used designer of course) with a attributes that probably refer to this type. Can this cause these troubles?