This project is read-only.

AutoPocoMap<T> idea

Apr 8, 2010 at 6:07 PM

I've been in discussion with @RobAshton about a way to configure the mappings in a similar way to that of FluentNHibernate by using an AutoPocoMap<T>.

An example of its usage:

    public class UserPocoMap : AutoPocoMap<User>
        public UserPocoMap()
            this.Setup(x => x.FirstName).Default();
            this.Setup(x => x.LastName);

My liking of this comes from wanting to have a single place which describes how an Entity is created in a valid state (especially when I have a large number of entities, having them all defined in a single place would become a maintainence headache). I'd then be able to register the PocoMaps with the EngineConfigurationBuilder via something like this


Robs been awesome enough to add the extensibility point I need to get a prototype of this working in my project.

Apr 8, 2010 at 6:40 PM

I like this, providing it's done by you and not me!

I think more and more configuration will get done by conventions as they get added, but I agree that a better way of isolating configuration might be necessary if you have a large amount of objects you want to map.

I'll get stuff sorted for this unless there are any objections from folk

Jan 7, 2011 at 9:26 PM

That would be great; we have about 100+ domain objects we deal with and we already have fluent mapping classes for each of them. Makes life easier.

Jan 9, 2011 at 11:31 AM

This really something you guys want?

I can set it up easy enough if so - should take me 5 minutes

Jan 9, 2011 at 11:33 AM

I'll see where I get with other tasks before then, feel free to implement it yourselves in the meantime - it is easy enough to create a new IConfigurationTypeProvider or whatever I called it to do this for you


I still advocate setting up most properties/etc via convention instead of on a per class basis of course.