This project is read-only.

Collections - Silverlight (CLOSED)

Oct 30, 2013 at 10:00 AM

I am having problems storing object(s) with generic collection field into NDatabase.

The documentation says:
"Circular references, immutable types, Exception class, collections, arrays, nullable types, primitive types and any custom type, all are supported by NDatabase."
So I was assuming "collections" means generics as well...

I'm using NDatabase 3.4 silverlight version (windows phone). My classes (simplified) are like this:
public class Airport
  public string ICAOCode;
  public List<Runway> Runways;

  public Airport()
     this.ICAOCode = "";
     this.Runways = new List<Runway>();

public class Runway
   public int Heading;
   public int Length;
All the fields in these classes are public and initialized at constructor, so there's no null values.
When I am trying to save an Airport object like this:
using (var odb = OdbFactory.Open(mDbName))
the odb.Store throws an exception:
NDatabase has thrown an Exception
Error:10:Internal error : getObjectInfoInternal  ---> System.FieldAccessException: Attempt by method 'NDatabase.Odb.Core.Layers.Layer1.Introspector.ObjectIntrospector.GetObjectInfoInternal(NDatabase.Odb.Core.Layers.Layer2.Meta.AbstractObjectInfo, System.Object, NDatabase.Odb.Core.Layers.Layer2.Meta.ClassInfo, Boolean, System.Collections.Generic.IDictionary`2<System.Object,NDatabase.Odb.Core.Layers.Layer2.Meta.NonNativeObjectInfo>, NDatabase.Odb.Core.Layers.Layer1.Introspector.IIntrospectionCallback)' to access field 'System.Collections.Generic.List`1<System.__Canon>._items' failed.
I appreciate any help.
Nov 1, 2013 at 8:22 AM
list is not matching the limits for Silverlight. Take a look on page:
Nov 1, 2013 at 9:29 AM

Well, I guess I just crawl back to my cave and continue with Linq2sql. Its a pity, really. NDatabase would've saved a huge amount of work.
Thanks anyway.