My LLBLGen Pro 3.0 Element Search Queries
Find entity fields by field name substring
Set the element type to NormalField.
return ( from e in p.EntityModel.Vertices
from f in e.Fields
where f.Name.ToLower().Contains("<substring>")
select f );
Find table fields in the project by field name
Set element type to TableField. This is using the SQL Server driver.
var metaData = p.MetaData.GetMetaDataForDriverID(SqlServerSqlClientDriverID);
var catalog = metaData.FindCatalogByName("CatalogName");
if(catalog==null)
{
return null;
}
var schema = catalog.FindSchemaByName("dbo");
var q = ( from t in schema.Tables
from f in t.Fields
where f.FieldName.ToLower() == "<substring>"
select f );
return q;
Find entities by name substring
Set element type to Entity.
var entities = from e in p.EntityModel.Vertices
where e.Name.ToLower().Contains("<substring>")
select e;
return entities;Set a type converter to all field mappings for a given database field type
Set the element type to NormalField. Set the client driver ID to the appropriate const in the top query fragment panel.
All of the updated fields will be listed in the query results.
List<FieldElement> updatedFields = new List<FieldElement>();
foreach ( EntityDefinition ed in p.EntityModel.Vertices )
{
foreach ( FieldElement field in ed.Fields )
{
FieldMapping fieldMapping = p.GetAllEntitiesWithTheirMappingsForDatabase(SqlServerSqlClientDriverID)[ed].GetFieldMappingOfField(field);
if ( fieldMapping.MappedTarget.DbTypeAsString == "<database type>" )
{
fieldMapping.TypeConverterToUse = p.GetTypeConverterDefinition("<TypeConverterName>");
updatedFields.Add(field);
}
}
}
return updatedFields;