Great, thanks for the fix!

I believe NHibernate can map any serializable class, not just Bitmap.

Attached to issue 198 is a patch with one failing test:
AutoMapManyToOne_WithSerializableParent(). I am over my head on this
one as Fluent needs to map as Many-To-One if the Fluent "knows" about
the parent, otherwise map as Column. I believe if this failing test
can be fixed, the patch is complete. Any ideas?

Note, this patch also include one other small change: NHibernate
cannot map all types in the System namespace, only the serializable
ones.

Thanks,
Brian


On Apr 18, 10:25 pm, Hudson Akridge <[email protected]> wrote:
> Brian, revision 448 should contain your fix. ;) Let me know if you still
> have problems.
>
> On Sat, Apr 18, 2009 at 9:24 PM, Hudson Akridge 
> <[email protected]>wrote:
>
> > Ah, sorry for the confusion Brian. Nothing to do with mapping a Bitmap, and
> > everything to do with the Automapper deciding that it's a many-to-one
> > reference instead of a direct type ;) I'll investigate and see if I can't
> > come up with a fix.
>
> > On Sat, Apr 18, 2009 at 5:51 PM, Paul Batum <[email protected]> wrote:
>
> >> Best way to tackle these problems is to look at the xml the automapper
> >> is generating. There is a method on AutoPersistenceModel called
> >> OutputMappings I think. It should spit the xml out to the console.
>
> >> On Sun, Apr 19, 2009 at 5:28 AM, Brian <[email protected]> wrote:
>
> >> > Thanks. You can directly map a Bitmap. This works:
>
> >> >    Map(o => o.MyBitmap).Not.Nullable();
>
> >> > However, I cannot get it to work with the auto mapping feature.
>
> >> > Thanks,
> >> > Brian
>
> >> > On Apr 17, 9:23 am, Tuna Toksoz <[email protected]> wrote:
> >> >> Or you can use a custom user type for that puirpose.
>
> >> >> Tuna Toksöz
> >> >> Eternal sunshine of the open source mind.
>
> >>http://devlicio.us/blogs/tuna_toksozhttp://tunatoksoz.comhttp://twitt...
>
> >> >> On Fri, Apr 17, 2009 at 7:22 PM, Hudson Akridge <
> >> [email protected]>wrote:
>
> >> >> > I don't believe you can map a bitmap directly. Look at mapping a
> >> byte[]
> >> >> > instead, that maps to a SQL column (BLOB). You can still represent
> >> the
> >> >> > property as a bitmap, but store it in the field that gets mapped as a
> >> byte[]
>
> >> >> > On Mon, Apr 13, 2009 at 10:33 PM, Brian <[email protected]>
> >> wrote:
>
> >> >> >> Hi,
>
> >> >> >> I cannot map a Bitmap with the auto mapper, but I can with standard
> >> >> >> mapping. Here is the entity:
>
> >> >> >>    public class Photo
> >> >> >>    {
> >> >> >>        public int Id { get; set; }
> >> >> >>        public Bitmap Bitmap { get; set; }
> >> >> >>    }
>
> >> >> >> With standard mapping (works)...
>
> >> >> >>    public class PhotoMapping : ClassMap<Photo>
> >> >> >>    {
> >> >> >>        public PhotoMapping()
> >> >> >>        {
> >> >> >>            Not.LazyLoad();
> >> >> >>            Id(o => o.Id);
> >> >> >>            Map(o => o.Bitmap).Not.Nullable();
> >> >> >>        }
> >> >> >>    }
>
> >> >> >> With automapping (fails)...
>
> >> >> >>    FluentConfiguration cfg = Fluently.Configure()
> >> >> >>         .Database(SQLiteConfiguration.Standard.InMemory())
> >> >> >>         .Mappings(m => m.AutoMappings
> >> >> >>                            .Add(AutoPersistenceModel
> >> >> >>                                    .MapEntitiesFromAssemblyOf<Photo>
> >> >> >> ()
> >> >> >>                                    .Where(t => t.Namespace ==
> >> >> >> "MyProject.Core.Domain")));
>
> >> >> >> I receive this error:
>
> >> >> >> NHibernate.MappingException: An association from the table Photo
> >> >> >> refers to an unmapped class: System.Drawing.Bitmap
> >> >> >>   at NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
> >> >> >>   at NHibernate.Cfg.Configuration.SecondPassCompileForeignKeys(Table
> >> >> >> table, ISet done)
> >> >> >>   at NHibernate.Cfg.Configuration.SecondPassCompile()
> >> >> >>   at NHibernate.Cfg.Configuration.BuildSessionFactory()
> >> >> >>   at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
> >> >> >>   --- End of inner exception stack trace ---
> >> >> >>   at FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory()
> >> >> >>   at FluentNHibernate.SessionSource..ctor(FluentConfiguration
> >> config)
>
> >> >> >> How can I tell the auto mapper to map Bitmaps as a property rather
> >> >> >> than a relationship?
>
> >> >> >> Thanks,
> >> >> >> Brian
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to