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
Mostrar archivo Open project: Kooboo/Ecommerce Class Usage Examples

Public Methods

Method 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

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

Method Details

GetDictionaryFieldName() public static method

public static GetDictionaryFieldName ( string propertyName, string dictionaryKey ) : string
propertyName string
dictionaryKey string
return string

ParseFieldValue() public static method

public static ParseFieldValue ( Type modelType, string field, string fieldValue ) : object
modelType System.Type
field string
fieldValue string
return object

ToDocument() public static method

public static ToDocument ( object model ) : Lucene.Net.Documents.Document
model object
return Lucene.Net.Documents.Document

ToModel() public static method

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

TryParseDictionaryFieldName() public static method

public static TryParseDictionaryFieldName ( string fieldName, string &propertyName, string &dictionaryKey ) : bool
fieldName string
propertyName string
dictionaryKey string
return bool