public PetaPocoMap <T> For <T>() { var definition = new PetaPocoTypeDefinition(typeof(T)); var petaPocoMap = new PetaPocoMap <T>(definition); Config.Add(typeof(T), definition); return(petaPocoMap); }
private static PetaPocoMappings CreateMappings(PetaPocoConventionScannerSettings scannerSettings, Type[] typesOverride) { var types = typesOverride ?? FindTypes(scannerSettings); var config = new Dictionary <Type, PetaPocoTypeDefinition>(); foreach (var type in types) { var petaPocoDefn = new PetaPocoTypeDefinition(type) { AutoIncrement = scannerSettings.PrimaryKeysAutoIncremented(type), PrimaryKey = scannerSettings.PrimaryKeysNamed(type), TableName = scannerSettings.TablesNamed(type), SequenceName = scannerSettings.SequencesNamed(type), }; foreach (var prop in type.GetProperties()) { var column = new PetaPocoColumnDefinition(); column.PropertyInfo = prop; column.DbColumnName = scannerSettings.PropertiesNamed(prop); column.IgnoreColumn = scannerSettings.IgnorePropertiesWhere.Any(x => x.Invoke(prop)); column.ResultColumn = scannerSettings.ResultPropertiesWhere(prop); column.VersionColumn = scannerSettings.VersionPropertiesWhere(prop); petaPocoDefn.ColumnConfiguration.Add(prop.Name, column); } config.Add(type, petaPocoDefn); } MergeOverrides(config, scannerSettings.MappingOverrides); var petaPocoMappings = new PetaPocoMappings { Config = config }; SetFactory(petaPocoMappings, null); return(petaPocoMappings); }
public PetaPocoMap(PetaPocoTypeDefinition petaPocoTypeDefinition) { _petaPocoTypeDefinition = petaPocoTypeDefinition; }