RaptorDB.RaptorDB.Save<T> throws System.InvalidCastException (v3.1.0)

Mar 19, 2014 at 12:02 PM
Edited Mar 19, 2014 at 1:40 PM
Hello, I wrote a very simple document/view test in an attempt to evaluate RaptorDB release v3.1.0 . Can someone please tell me what I have done wrong in the following code? In this example, RaptorDB.RaptorDB.Save<T> throws System.InvalidCastException:
public class Phrase
{
    public Phrase()
    {
        ID = Guid.NewGuid();
    }
    public Guid     ID      { get; set; }
    public string   Key     { set; get; }
    public string   Value   { set; get; }
}

public class PhraseViewRowSchema : RDBSchema
{
    [FullText]
    public string Key   ;
    public string Value ;
}

[RegisterView]
public class PhraseView : View<Phrase>
{
    public PhraseView()
    {
        this.Name = "Phrase";
        this.Description = "A primary view for Phrase";
        this.isPrimaryList = true;
        this.isActive = true;
        this.BackgroundIndexing = false;
        this.Schema = typeof(PhraseViewRowSchema);
        this.AddFireOnTypes(typeof(Phrase));

        this.Mapper = (api, docid, doc) =>
        {
            api.Emit(docid, doc);
        };
    }
}

class Program
{
    static void Main(string[] args)
    {
        RaptorDB.RaptorDB raptorDB = RaptorDB.RaptorDB.Open(@"c:\temp\RaptorDB.data");
        raptorDB.RegisterView(new PhraseView());

        Phrase phrase= new Phrase() {Key = "127", Value = "Ascension Island"};
        raptorDB.Save<Phrase>(phrase.ID,phrase); // <---------- EXCEPTION HERE

        var result = raptorDB.Query<PhraseViewRowSchema>(x => x.Key == "127");

        raptorDB.Shutdown();
    }
}
Stack trace is as follows:

at RaptorDB.FullTextIndex.Set(Object key, Int32 recnum) in c:\gdWork\downloads\RaptorDB\3.1.0\RaptorDB\Indexes\Indexes.cs:line 213
at RaptorDB.Views.ViewHandler.IndexRow(Guid docid, Object[] row, Int32 rownum) in c:\gdWork\downloads\RaptorDB\3.1.0\RaptorDB\Views\ViewHandler.cs:line 749
at RaptorDB.Views.ViewHandler.InsertRowsWithIndexUpdate(Guid guid, List1 rows) in c:\gdWork\downloads\RaptorDB\3.1.0\RaptorDB\Views\ViewHandler.cs:line 706
at RaptorDB.Views.ViewHandler.SaveAndIndex(Dictionary
2 rows) in c:\gdWork\downloads\RaptorDB\3.1.0\RaptorDB\Views\ViewHandler.cs:line 168
at RaptorDB.Views.ViewHandler.Insert[T](Guid guid, T doc) in c:\gdWork\downloads\RaptorDB\3.1.0\RaptorDB\Views\ViewHandler.cs:line 157
at RaptorDB.Views.ViewManager.Insert[T](String viewname, Guid docid, T data) in c:\gdWork\downloads\RaptorDB\3.1.0\RaptorDB\Views\ViewManager.cs:line 192
at RaptorDB.RaptorDB.SaveInPrimaryView[T](String viewname, Guid docid, T data) in c:\gdWork\downloads\RaptorDB\3.1.0\RaptorDB\RaptorDB.cs:line 968
at RaptorDB.RaptorDB.Save[T](Guid docid, T data) in c:\gdWork\downloads\RaptorDB\3.1.0\RaptorDB\RaptorDB.cs:line 175
at FunWithRDB310.Program.Main(String[] args) in c:\temp\FunWithRDB310\FunWithRDB310\Program.cs:line 56
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Thank you.