/// <summary> /// Gets the default conventions. /// </summary> public static IRepositoryConventions Default() { var conventions = new RepositoryConventions { PrimaryKeysCallback = pi => PrimaryKeyConventionHelper.GetPrimaryKeyPropertyInfos(pi) }; return(conventions); }
/// <summary> /// Gets the default conventions. /// </summary> /// <typeparam name="TOwner">The type that owns this conventions.</typeparam> public static IRepositoryConventions Default <TOwner>() where TOwner : IRepositoryContext { var conventions = new RepositoryConventions(typeof(TOwner)); conventions.PrimaryKeysCallback = pi => PrimaryKeyConventionHelper.GetPrimaryKeyPropertyInfos(conventions, pi); conventions.ForeignKeysCallback = (sourceType, foreignType) => ForeignKeyConventionHelper.GetForeignKeyPropertyInfos(conventions, sourceType, foreignType); conventions.TableNameCallback = type => ModelConventionHelper.GetTableName(type); conventions.ColumnNameCallback = pi => ModelConventionHelper.GetColumnName(pi); conventions.ColumnOrderCallback = pi => ModelConventionHelper.GetColumnOrder(conventions, pi); conventions.IsColumnIdentityCallback = pi => ModelConventionHelper.IsColumnIdentity(conventions, pi); conventions.IsColumnMappedCallback = pi => ModelConventionHelper.IsColumnMapped(pi); return(conventions); }