Can someone tell me how to make my property convention ignore a mapping that has formula?
This is the entity:
public class User
{
public virtual int Id {get; set;}
public virtual string FirstName {get; set;}
public virtual string LastName {get; set;}
public virtual string F开发者_如何转开发ullName {get; set;}
}
This is the mapping:
public class UserMap : ClassMap<User>
{
public UserMap()
{
Id(x => x.Id);
Map(x => x.FirstName);
Map(x => x.LastName);
Map(x => x.FullName).Formula("first_name || ' ' || last_name");
}
}
I want my property convention to ignore the FullName property. Thanks for helping
Is your convention implementing IConventionAcceptance (or the equivalent IPropertyConventionAcceptance)? From there, within the Accept method, you can access the "Formula" property and return true/false appropriately. This will prevent your convention from processing the property.
精彩评论