Skip to content

Instantly share code, notes, and snippets.

@stevenharman
Created February 4, 2009 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevenharman/58209 to your computer and use it in GitHub Desktop.
Save stevenharman/58209 to your computer and use it in GitHub Desktop.
using System.Reflection;
using FluentNHibernate.AutoMap;
using FluentNHibernate.Framework;
using MyApplication.Core.Domain;
namespace MyApplication.Core.Persistence
{
public class MyCustomPersistenceModel : AutoPersistenceModel
{
public MyCustomPersistenceModel()
{
AddEntityAssembly(Assembly.GetAssembly(typeof(ValueObject<>)))
.WithConvention(c =>
{
c.IsBaseType = type => (type == typeof(Entity) || type == typeof(ValueObject<>));
})
.Where(t => t.IsSubclassOf(typeof(Entity)) || t.IsSubclassOf(typeof(ValueObject<>)))
.Where(t => t.Namespace == "MyApplication.Core.Domain");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment