Forked from stevenharman/MyCustomPersistenceModel.cs
Created
February 4, 2009 16:58
-
-
Save jagregory/58204 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 => IsBaseType(type); | |
}) | |
.Where(t => t.Namespace == "MyApplication.Core.Domain" && IsBaseType(type.BaseType)); | |
} | |
private bool IsBaseType(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