An assembly contains classes like
public class CustomPage : Page, ISearchable
{
[Searchable]
public virtual string CustomText { get; set; }
public virtual string SearchableText { get; set; }
}
which I would like to map to Lucene.net. I can't add attributes to those classes and can't use ISearchMapping either, because the types are unknown (no reference to that assembly).
How can I do the mappings? All available information is that all types inherit Page and implement ISearchable. The only property to map is the SearchableText (before saving all the properties with [Searchable] are concatenated to that property).
You can use this design Generic DAO Object. I built an entire infrastructure using this implementation. You create an generic DAO and use it with any type of mapped object.
This is a very simplified example, I made a much more complex version across more than a hundred classes and it works great.