Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions source/Lucene.Net.Linq/Mapping/ReflectionDocumentMapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ namespace Lucene.Net.Linq.Mapping
/// </summary>
public class ReflectionDocumentMapper<T> : DocumentMapperBase<T>
{
protected static PropertyInfo[] properties = null;

/// <summary>
/// Constructs an instance that will create an <see cref="Analyzer"/>
/// using metadata on public properties on the type <typeparamref name="T"/>.
Expand All @@ -44,11 +46,12 @@ public ReflectionDocumentMapper(Version version, Analyzer externalAnalyzer)
private ReflectionDocumentMapper(Version version, Analyzer externalAnalyzer, Type type)
: base(version, externalAnalyzer)
{
var props = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);
if (properties == null)
properties = type.GetProperties(BindingFlags.Public | BindingFlags.Instance);

BuildFieldMap(props);
BuildFieldMap(properties);

BuildKeyFieldMap(type, props);
BuildKeyFieldMap(type, properties);
}

private void BuildFieldMap(IEnumerable<PropertyInfo> props)
Expand Down Expand Up @@ -85,4 +88,4 @@ private void BuildKeyFieldMap(Type type, IEnumerable<PropertyInfo> props)
}
}
}
}
}