Readonly collection properties that NHibernate can work with -


There are such collections in my domain classes that look like this:

  Lt; Foo & gt; _foos = new list & lt; Foo & gt; (); Public Virtual Readline Collection & lt; Foo & gt; Foos {Back {Return _foos.AsReadOnly (); }}  

This gives me a read-only archive that can be modified from within the class (i.e. using field _foos).

This archive is mapped as follows (Fluent NHibernate):

  is similar (x = & gt; x.foos) .Key column ("Parent Class ID") . Cascade all (). Inverted (). Access.CamelCaseField (Prefix.Underscore);  

Now when I try to use this collection, I get:

Object type 'NHibernate.collection.Generic.PersistentGenericBag 1 [Foo] 'Type' System.Collections.Generic.List to type '[Foo]'. According to

, this is because NHibernate should be exposed as an interface in order to inject NHibernate one of its own collection sections.

The article suggests using ILIIS instead, but the regret is that in this interface the AsReadOnly () method is not included, only to highlight the only one readable archive for the outside world Mumble plans

Anyone can suggest what interface I can use instead, a different approach that meets the same needs, or an alternative career in which it is very frustrating. Do not get it?

thanks

David

the ARDOnly () method one Not the only way to get the readonly collection. Private IList & lt; Foo & gt; _foos = new list & lt; Foo & gt; (); Public Virtual Readline Collection & lt; Foo & gt; Foos {Back to New Readline Collection & lt; Foo & gt; (_ Foos); }}

Another circle jumped.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -