Skip to content

Instantly share code, notes, and snippets.

@stevenharman
Created February 4, 2009 17:10
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/58213 to your computer and use it in GitHub Desktop.
Save stevenharman/58213 to your computer and use it in GitHub Desktop.
using System;
using System.Reflection;
using FluentNHibernate.AutoMap;
using FluentNHibernate.Framework;
using MyApplication.Core.Domain;
namespace MyApplication.Core.Persistence
{
public class MyApplicationPersistenceModel : AutoPersistenceModel
{
public MyApplicationPersistenceModel()
{
AddEntityAssembly(Assembly.GetAssembly(typeof(ValueObject<>)))
.WithConvention(c => c.IsBaseType = is_layer_super_type)
.Where(t => t.Namespace == "MyApplication.Core.Domain" && !is_layer_super_type(t));
}
private static bool is_layer_super_type(Type type)
{
return (type == typeof(Entity) || type == typeof(ValueObject<>));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment