here are the hbm files that fluent is exporting:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-
access="">
  <class name="Xipp.Model.Aspnet_User, Xipp.Model, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null" table="aspnet_Users"
xmlns="urn:nhibernate-mapping-2.2">
    <id name="UserId" type="Guid" column="UserId">
      <generator class="guid" />
    </id>
    <property name="ApplicationId" type="Guid">
      <column name="ApplicationId" />
    </property>
    <property name="UserName" type="String">
      <column name="UserName" />
    </property>
    <property name="LoweredUserName" type="String">
      <column name="LoweredUserName" />
    </property>
    <property name="MobileAlias" type="String">
      <column name="MobileAlias" />
    </property>
    <property name="IsAnonymous" type="Boolean">
      <column name="IsAnonymous" />
    </property>
    <property name="LastActivityDate" type="DateTime">
      <column name="LastActivityDate" />
    </property>
    <bag name="Roles" cascade="all" table="aspnet_UsersInRoles">
      <key column="UserId" />
      <many-to-many column="RoleId" class="Xipp.Model.Aspnet_Role,
Xipp.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    </bag>
    <bag name="Orders" cascade="all" inverse="true">
      <key column="UserName" />
      <one-to-many class="Xipp.Model.Order, Xipp.Model,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
    </bag>
  </class>
</hibernate-mapping>

and the relevant part from the order mapping

<many-to-one foreign-key="UserName" name="User" column="UserName" />



On Jun 17, 2:16 pm, Josh Pollard <j...@thepollardfamily.net> wrote:
> My database is using the aspnet membership provider for all of the
> user stuff. I hate guids though, so our tables that have relationships
> with the user tables are all tied back to the username field, not
> userid. So the table that I'm trying to map is an Order table that has
> a field called username in it. Here are my mapping classes:
>
> public Aspnet_UserMap()
>         {
>             WithTable("aspnet_Users");
>
>             Id(x => x.UserId).GeneratedBy.Guid();
>             Map(x => x.ApplicationId);
>             Map(x => x.UserName);
>             Map(x => x.LoweredUserName);
>             Map(x => x.MobileAlias);
>             Map(x => x.IsAnonymous);
>             Map(x => x.LastActivityDate);
>
>             HasManyToMany(x => x.Roles)
>                 .Cascade.All()
>                 .WithTableName("aspnet_UsersInRoles")
>                 .WithParentKeyColumn("UserId")
>                 .WithChildKeyColumn("RoleId");
>
>             HasMany<Order>(x => x.Orders)
>                 .AsBag().Cascade.All().Inverse().KeyColumnNames.Add
> ("UserName");
>         }
>
> //// and here is the order map
>
>         public OrderMap()
>         {
>             Id(x => x.Id);
>             Map(x => x.Submitted);
>             Map(x => x.DateSubmitted);
>   /// .... some fields removed to keep this short
>
>             References(x => x.User).ColumnName("UserName");
>         }
>
> But when I try to retrieve an Order by its Id, I get the following
> exception:
>
>  System.FormatException: Guid should contain 32 digits with 4 dashes
> (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)..
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to