Collection indexing in embedded mode

Sep 28, 2015 at 9:29 AM
I have noticed in the samples that SalesInvoiceViewRowSchema does not fully reflect SalesInvoice structure and the Items property is missing. I tried to change it myself, I incremented the version, I removed the test folder - to make the engine start from scratch - but the engine fails to load the SalesInvoiceView view throwing an exception:

GenericArguments[0], 'System.Collections.Generic.List1[SampleViews.LineItem]', on 'RaptorDB.TypeIndexes1[T]' violates the constraint of type 'T'.

And the stack trace is:

at System.RuntimeType.ValidateGenericArguments(MemberInfo definition, RuntimeType[] genericArguments, Exception e)
at System.RuntimeType.MakeGenericType(Type[] instantiation)
at RaptorDB.Views.ViewHandler.CreateIndex(String name, Type type) in c:\Temp\RaptorDB\RaptorDB doc v3.2.15\RaptorDB\Views\ViewHandler.cs:line 1027
at RaptorDB.Views.ViewHandler.CreateLoadIndexes(ViewRowDefinition viewRowDefinition) in c:\Temp\RaptorDB\RaptorDB doc v3.2.15\RaptorDB\Views\ViewHandler.cs:line 831
at RaptorDB.Views.ViewHandler.SetView[T](View1 view, IDocStorage1 docs) in c:\Temp\RaptorDB\RaptorDB doc v3.2.15\RaptorDB\Views\ViewHandler.cs:line 156
at RaptorDB.Views.ViewManager.RegisterView[T](View1 view) in c:\Temp\RaptorDB\RaptorDB doc v3.2.15\RaptorDB\Views\ViewManager.cs:line 160
at RaptorDB.RaptorDB.RegisterView[T](View
1 view) in c:\Temp\RaptorDB\RaptorDB doc v3.2.15\RaptorDB\RaptorDB.cs:line 260
at datagridbinding.frmStartup.button1_Click(Object sender, EventArgs e) in c:\Temp\RaptorDB\RaptorDB doc v3.2.15\datagridbinding\frmStartup.cs:line 35

However, in the 'server' version seems to be included in searches. Is there a reason why collections/nested-documents are not supported/indexed/used in embedded mode?
Coordinator
Sep 28, 2015 at 9:40 AM
Views are 2 dimensional so you are not supposed to have master/detail structures within a single view-> so you can't have LineItems in the master view for a SalesInvoice.

If you need the detail you can create another view (much like RDBMS) and only populate that. see the newview sample.