Class SourceFieldProvider
- Namespace
- Dynamicweb.Ecommerce.ProductCatalog.SchemaOrg
- Assembly
- Dynamicweb.Ecommerce.dll
Supplies the product fields that can be used as the source of a Schema.org property mapping.
public abstract class SourceFieldProvider
- Inheritance
-
SourceFieldProvider
- Inherited Members
Remarks
This is the boundary between the Schema.org feature and the product field catalogue: everything the feature needs to know about a source field it asks for here, so nothing else has to interpret field types, field identifiers or the field catalogue itself.
Register an implementation to change which fields can be mapped, or to map from somewhere other than the product field catalogue.
Methods
Find(string)
Gets the source field with the given unique system name.
public abstract SourceField? Find(string sourceFieldId)
Parameters
sourceFieldIdstringThe unique system name of the field.
Returns
- SourceField
The field, or
nullwhen no field with that name can be used as a source.
FindAll(IEnumerable<string>)
Gets the source fields with the given unique system names, reading the field catalogue once.
public abstract IReadOnlyCollection<SourceField> FindAll(IEnumerable<string> sourceFieldIds)
Parameters
sourceFieldIdsIEnumerable<string>The unique system names of the fields.
Returns
- IReadOnlyCollection<SourceField>
The fields that exist and can be used as a source; unknown names are left out.
GetSelectable(SchemaOrgProductProperty)
Gets the fields that can be selected as the source of the given Schema.org property.
public abstract IEnumerable<SourceField> GetSelectable(SchemaOrgProductProperty productProperty)
Parameters
productPropertySchemaOrgProductPropertyThe property a source field is selected for.
Returns
- IEnumerable<SourceField>
The selectable source fields, in no particular order.
IsSelectable(string, SchemaOrgProductProperty)
Gets a value indicating whether the given field can be mapped to the given Schema.org property, that is whether it can be used as a source at all and holds a kind of value the property accepts.
public abstract bool IsSelectable(string sourceFieldId, SchemaOrgProductProperty productProperty)
Parameters
sourceFieldIdstringThe unique system name of the field.
productPropertySchemaOrgProductPropertyThe property the field would be mapped to.
Returns
- bool
truewhen the field is a valid source for the property.
IsSupported(string)
Gets a value indicating whether the given field can be used as a mapping source at all, that is whether its value can be read from a ProductViewModel.
public abstract bool IsSupported(string sourceFieldId)
Parameters
sourceFieldIdstringThe unique system name of the field.
Returns
- bool
truewhen the field can be used as a source.