C# Class Kooboo.Commerce.Search.ModelConverter

Converts poco model to lucene document, or converts lucene document to poco model.
A poco model is converted to document with these rules: 1. For simple property (e.g., Int32, String, Decimal) - Create a normal lucene field (or numeric field) 2. For list/set/array property - Create a multi-valued field 3. For dictionary property - Create a field for each key, and the field name format is PropertyName[DictionaryKey] - The dictionary value can be a simple type or a list/set, if it's a list/set, a multi-valued field is created for each key
Afficher le fichier Open project: Kooboo/Ecommerce Class Usage Examples

Méthodes publiques

Méthode Description
GetDictionaryFieldName ( string propertyName, string dictionaryKey ) : string
ParseFieldValue ( Type modelType, string field, string fieldValue ) : object
ToDocument ( object model ) : Lucene.Net.Documents.Document
ToModel ( Lucene.Net.Documents.Document document, Type modelType ) : object
TryParseDictionaryFieldName ( string fieldName, string &propertyName, string &dictionaryKey ) : bool

Private Methods

Méthode Description
GetAddMethod ( Type collectionType, Type elementType ) : MethodInfo
ToFields ( object container, PropertyInfo property ) : IEnumerable

Method Details

GetDictionaryFieldName() public static méthode

public static GetDictionaryFieldName ( string propertyName, string dictionaryKey ) : string
propertyName string
dictionaryKey string
Résultat string

ParseFieldValue() public static méthode

public static ParseFieldValue ( Type modelType, string field, string fieldValue ) : object
modelType System.Type
field string
fieldValue string
Résultat object

ToDocument() public static méthode

public static ToDocument ( object model ) : Lucene.Net.Documents.Document
model object
Résultat Lucene.Net.Documents.Document

ToModel() public static méthode

public static ToModel ( Lucene.Net.Documents.Document document, Type modelType ) : object
document Lucene.Net.Documents.Document
modelType System.Type
Résultat object

TryParseDictionaryFieldName() public static méthode

public static TryParseDictionaryFieldName ( string fieldName, string &propertyName, string &dictionaryKey ) : bool
fieldName string
propertyName string
dictionaryKey string
Résultat bool