Well known where? What did you find? /Oskar
2012/9/27 Fabricio Martinez <[email protected]> > Well this seems to be a well know limitation. My solution, I went back to > 3.2. > > > On Wednesday, September 26, 2012 11:39:04 AM UTC+2, Fabricio Martinez > wrote: >> >> .OrderBy(x => x.**FrontpagePosition ?? int.**MaxValue) Linq code does not >> work anymore with NHIbernate... >> >> >> Any thoughts? >> >> >> -Thanks, >> >> Fabricio >> >> >> On Tuesday, September 25, 2012 11:45:30 PM UTC+2, Fabricio Martinez wrote: >>> >>> Hello, >>> >>> I have just upgraded NHIbernate and Fluent to the latest versions (NH to >>> 3.3.1.4000 and Fluent to 1.3.0.733) and my working solution has stop >>> working with certain objects with the following error. >>> >>> {System.**IndexOutOfRangeException: Invalid index 3 for this >>> SqlParameterCollection with Count=3. >>> at System.Data.SqlClient.**SqlParameterCollection.**RangeCheck(Int32 >>> index) >>> at System.Data.SqlClient.**SqlParameterCollection.**GetParameter(Int32 >>> index) >>> at System.Data.Common.**DbParameterCollection.System.** >>> Collections.IList.get_Item(**Int32 index) >>> at NHibernate.Type.Int32Type.Set(**IDbCommand rs, Object value, >>> Int32 index) >>> at NHibernate.Type.NullableType.**NullSafeSet(IDbCommand cmd, Object >>> value, Int32 index) >>> at NHibernate.Type.NullableType.**NullSafeSet(IDbCommand st, Object >>> value, Int32 index, ISessionImplementor session) >>> at NHibernate.Param.**NamedParameterSpecification.**Bind(IDbCommand >>> command, IList`1 multiSqlQueryParametersList, Int32 >>> singleSqlParametersOffset, IList`1 sqlQueryParametersList, QueryParameters >>> queryParameters, ISessionImplementor session) >>> at NHibernate.Param.**NamedParameterSpecification.**Bind(IDbCommand >>> command, IList`1 sqlQueryParametersList, QueryParameters queryParameters, >>> ISessionImplementor session) >>> at NHibernate.SqlCommand.**SqlCommandImpl.Bind(IDbCommand command, >>> ISessionImplementor session) >>> at NHibernate.Loader.Loader.**PrepareQueryCommand(**QueryParameters >>> queryParameters, Boolean scroll, ISessionImplementor session) >>> at NHibernate.Loader.Loader.**DoQuery(ISessionImplementor session, >>> QueryParameters queryParameters, Boolean returnProxies) >>> at >>> NHibernate.Loader.Loader.**DoQueryAndInitializeNonLazyCol**lections(ISessionImplementor >>> session, QueryParameters queryParameters, Boolean returnProxies) >>> at NHibernate.Loader.Loader.**DoList(ISessionImplementor session, >>> QueryParameters queryParameters)} >>> >>> What its weird to me is that this was working perfectly. >>> >>> The object is as follows. >>> >>> [DataContract(IsReference = t**rue)] >>> [KnownType(typeof(Categori**a))] >>> [KnownType(typeof(Comentar**io))] >>> public partial class Notic**ia >>> { >>> [DataMember] >>> public virtual long **Id { get; set; } >>> >>> [DataMember] >>> public virtual string **Asunto { get; set; } >>> >>> [DataMember] >>> public virtual string **Intro { get; set; } >>> >>> [DataMember] >>> public virtual string **Texto { get; set; } >>> >>> [DataMember] >>> public virtual bool **Publicar { get; set; } >>> >>> [DataMember] >>> public virtual Categor**ia Categoria { get; set; } >>> >>> [DataMember] >>> public virtual Product**o Producto { get; set; } >>> >>> [DataMember] >>> public virtual Empresa** Empresa { get; set; } >>> >>> [DataMember] >>> public virtual IList<C**omentario> Comentario { get; s**et; } >>> >>> [DataMember] >>> public virtual bool **Frontpage { get; set; } >>> >>> [DataMember] >>> public virtual int? **FrontpagePosition { get; set; **} >>> >>> [DataMember] >>> public virtual string **Tags { get; set; } >>> >>> [DataMember] >>> public virtual Usuario** Creador { get; set; } >>> >>> [DataMember] >>> public virtual DateTim**e FechaAlta { get; set; } >>> } >>> >>> Mapping: >>> public partial class NoticiaMa**p: ClassMap<Noticia> >>> { >>> public NoticiaMap() >>> { >>> //Table("**NoticiaSet"); >>> Id(x => x.Id).**GeneratedBy.Identity(); >>> HasMany(x => >>> x.**Comentario).LazyLoad().**Inverse().Cascade.All(); >>> References(x => x.**Categoria).Nullable(); >>> References(x => x.**Empresa).Nullable(); >>> References(x => x.**Producto).Nullable(); >>> Map(x => x.**Publicar).Not.Nullable(); >>> Map(x => x.Asunto)**.Length(512).Not.Nullable(); >>> Map(x => x.Intro).**Length(1024).Nullable(); >>> Map(x => >>> x.Texto).**CustomType("StringClob").**CustomSqlType("nvarchar(max)")**.Not.Nullable(); >>> Map(x => x.**FechaAlta).Not.Nullable(); >>> Map(x => x.**Frontpage).Not.Nullable().**Default("0"); >>> Map(x => x.**FrontpagePosition).Nullable(); >>> Map(x => x.Tags).**Length(512).Nullable(); >>> References(x => x.**Creador).Not.Nullable(); >>> } >>> } >>> >>> Code Failing: >>> @foreach (var item in Model) >>> { >>> <div c**lass="row"> >>> <d**iv style="text-align:center;" **class="one >>> columns">@item.**Publicar.ToString()</div> >>> <d**iv style="text-align:center;" **class="one >>> columns">@item.**Frontpage</div> >>> <d**iv style="text-align:center;" **class="one >>> columns">@item.**FrontpagePosition</div> >>> <d**iv style="text-align:center;" >>> **class="three columns">@item.**Asunto</div> >>> <d**iv style="text-align:center;" **class="one >>> columns"> >>> ** @if (item.Categoria != null)** { >>> @item.Categoria.Nombre } >>> ** @if (item.Empresa != null) {** >>> @item.Empresa.Nombre } >>> ** @if (item.Producto != null) **{ >>> @item.Producto.Nombre } >>> </**div> >>> <d**iv style="text-align:center;" **class="one >>> columns">@item.**Creador.Nombre</div> >>> <d**iv style="text-align:center;" **class="one >>> columns">@item.**FechaAlta.ToShortDateString()<**/div> >>> <d**iv style="text-align:center;" >>> **class="three columns"> >>> ** <a href="#" >>> onclick="**javascript:SourceInjector('#**Content', >>> '@Url.Action("**Modificar", "Noticia", new { i**d = item.Id >>> })')">Modificar</a**> || >>> ** @Ajax.ActionLink("Eliminar",** >>> "Eliminar", "Noticia", new { **id = item.Id }, new AjaxOption**s { Confirm >>> = "¿Eliminar **Noticia " + item.Asunto + "?",** HttpMethod = "Post", >>> **UpdateTargetId = "Content" }, **null) || >>> ** <a >>> href="@Url.Action(item.Id**.ToString(), "Articulo")" >>> targ**et="_blank">Preview</a> >>> </**div> >>> </div> >>> } >>> >>> >>> As soon as it goes into the foreach it fails. What baffles me is that this >>> was working before. >>> >>> Any help welcomed. >>> >>> -Cheers, >>> Fabricio >>> >>> >>> -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/nhusers/-/Z880m5AwNYMJ. > > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
