3
votes

I am trying to load a document by its id from a domain that does not have the CLR type that was stored.

The original structure looks something like this:

public class Document
{
    public int DocumentId {get;set;}
    public string SomeValue {get;set;}
    public List<Data> Data {get;set;}
}

public abstract class Data { }
public class Data1 : Data 
{
    public string SomeOtherValue {get;set;}
}

Now in my second project which does not have access to this structure i try to load it by using the duck-typing features of raven with a class that looks the same.

public class Document
{
    public int DocumentId {get;set;}
    public string SomeValue {get;set;}
    //public List<Data> Data {get;set;}
}

public abstract class Data { }
public class Data1 : Data 
{
    public string SomeOtherValue {get;set;}
}

If i do not include the Data parameter (as above) in this class it loads fine, but if i do include it it fails with an error saying it doesn't know about the original type stored ("Could not load assembly 'OriginalAssemblyName'"). Is there any way to make raven duck-type the list of objects as well instead of trying to cast it to a type i don't have access to?

1

1 Answers

0
votes

I have been working on something very similar and stumbled across this. Loading the object from the session as a JObject seems to work ok for me. sesssion.Load(id). I am trying to do something a little more complicated and still having issues. Ongoing thread at https://groups.google.com/forum/#!topic/ravendb/y3-SVB18xVg