public static IList<IConvention> ToConventions(ConventionOptions options) {
options.ShouldNotBeNull("optioons");
if(IsDebugEnabled)
log.Debug("ConventionOptions 정보로 IConvention[]을 빌드합니다... " + options);
var conventions = new List<IConvention>();
conventions.Add((options.DefaultLazy) ? LazyLoad.Always() : LazyLoad.Never());
if(options.DynamicInsert)
conventions.Add(FluentNHibernate.Conventions.Helpers.DynamicInsert.AlwaysTrue());
if(options.DynamicUpdate)
conventions.Add(FluentNHibernate.Conventions.Helpers.DynamicUpdate.AlwaysTrue());
if(options.TableNamePrefix.IsNotWhiteSpace())
conventions.Add(Table.Is(x => options.TableNamePrefix + x.EntityType.Name));
else if(options.TableNamePrefix.IsNotWhiteSpace())
conventions.Add(Table.Is(x => x.EntityType.Name + options.TableNameSurfix));
else
conventions.Add(Table.Is(x => x.EntityType.Name));
if(options.PrimaryKeyName.IsNotWhiteSpace())
conventions.Add(PrimaryKey.Name.Is(x => options.PrimaryKeyName));
else if(options.PrimaryKeySurfix.IsNotWhiteSpace())
conventions.Add(PrimaryKey.Name.Is(x => x.EntityType.Name + options.PrimaryKeySurfix));
if(options.ForeignKeySurfix.IsNotWhiteSpace()) {
conventions.Add(ForeignKey.EndsWith(options.ForeignKeySurfix));
conventions.Add(ConventionBuilder.HasMany.Always(x => x.Key.Column(x.EntityType.Name + options.ForeignKeySurfix)));
conventions.Add(ConventionBuilder.Reference.Always(x => x.Column(x.Property.Name + options.ForeignKeySurfix)));
conventions.Add(ConventionBuilder.HasManyToMany.Always(x => {
x.Key.Column(x.EntityType.Name + options.PrimaryKeySurfix);
x.Relationship.Column(x.ChildType.Name +
options.ForeignKeySurfix);
}));
}
return conventions;
}