asp.net - NHibernate.IFutureValue when serialized includes .Value -


I am building an ASP.net (2.0, no, I can not change this) site with NHibernate, And a custom JSON converter, so I can serialize the properties, which I want to hide from the customer. It allows me to return objects, and never have to worry about their ordered values ​​- they are always safe.

Unfortunately, it seems that if I query.FutureValue & lt; Class & gt; , the object that is serialized is first NHibernate.Impl.FutureValue & lt; Class & gt; is not my entity, which means that I get JSON which looks like this if I put it in a dictionary and return it to the customer:

  {Key: {value: {/ * My serial object properties}}   

I first discovered that I can not have any interface to work with ASP's JavaScript converter implementation Get ... only regular or abstract class so typeof (IFutureValue Returning as a merit type means that my converter has been completely ignored. I can hold MyBaseClass because I first re-implement things to use an abstract basis instead of an interface, but not the interface.

And then I find out that the Future Value implementation in the IPL is internal to the assembly or any other crap that only my NET works to make the experience more painful. So I can not use the typeof (FutureValue & lt; MyBaseClass & gt;) to handle it all, because the future value exists only in my debugging sessions.

Is there a way to get class type out of the assembly? Or is there a way to explain ASP that the interface actually uses? Or maybe I can access some superclasses, which will tell me about the whole problem?

Help! I like your futures, it gives me a whole heck tone call at a time!

(If something is not clear, or if you want more code than all methods, then ask me! I can post a bit.)

If I understand you correctly, then it seems that you are mixing things together a little bit.

It looks like you query.FutureValue & lt; Class & gt; Trying to serialize a frequency of () , which gives you amazingly only: a JSON object where JSON represents your unit in the value field.

It seems to me that you want to serial only actually query.FutureValue .

Using NHibernate futures in this way gives you a little profit, so you probably do something similar:

  var future1 = query1.FutureValue & lt; SomeEntity & gt; (); Var future2 = query2.FutureValue & lt; AnotherEntity & gt; (); Var json1 = serializer.Serialize (future 1. value); // & LT; BAM! Multi-query is removed! Var json2 = serializer.Serialize (future2.Value);   

Does this mean?

Comments