For example, I have the next convention:
public sealed class IdKeyConvention : ITypePropertyConvention
{
public void SpecifyRequirements(ITypeMemberConventionRequirements requirements)
{
requirements.Name(x => x == "Id");
requirements.Type(x => x == typeof(int));
}
public void Apply(ITypePropertyConventionContext context)
{
context.SetSource<IdKeyDataSource>();
}
}
and the factory
var factory = AutoPocoContainer.Configure(x =>
{
x.Conventions(c =>
{
c.UseDefaultConventions();
c.ScanAssembly(typeof(FactoryContainer).Assembly);
});
x.AddFromAssemblyContainingType<Customer>();
//x.Include<...>()...
});
It allows me to don't think about key and store generated entities to a test DB. But it does not work for entities on the second level of properties for example, and I have to expose them explicitly =(
For example, I have the next convention:
and the factory
It allows me to don't think about key and store generated entities to a test DB. But it does not work for entities on the second level of properties for example, and I have to expose them explicitly =(