NHIBERNATE: How to map a collection into the DB using Mapping.Attributes -


I have this product class which I have taken from examples of navigator use (but I made some amendments in it) Want to be able to map a square and all its references in DB [NHibernate.Mapping.Attributes.Class (lazy = true)] Public class product {{NHibernate.Mapping.AttributesIID (name = "id", type type = typef (guide)) ] {Receive Public Virtual Guide ID; Set; } [NHibernate.Mapping.Attributes.Property] Public Virtual String Name {get; Set; } [NHibernate.Mapping.Attributes.Property] Get the Public Virtual Ent Category { Set; } [NHibernate.Mapping.Attributes.Property] Public Virtual Bulb closed {get; Set; } [NHibernate.Mapping.Attributes.Map (name = "item")] Public Virtual Dictionary & lt; Guid, SubItem & gt; Product {Received; Set; }}

Where subitem is defined as:

  [NHibernate.Mapping.Attributes.Class (lazy = true)] Public class subtitles {{NHibernate Mapping. Features. (Name = "id", type type = typef (guide))] {Receive Public Virtual Guide ID; Set; } [NHibernate.Mapping.Attributes.Property] Public Virtual String Name {get; Set; }}  

And I get the following quote that "element in the namespace" is the incomplete content of the 'map' vase: nhibernate-maping-2.2 '' Maybe something that is behind it But I do not know what that is and if this is the right way to do this (I want to serialize the following object:

  Subtitle all 1 = new subtitle (); all 1 Id = guid nuigide (); all 1 .name = "all 1"; subtitle all 2 = new subtitle (); all 2. id = grid.NewGuide () ; All 2. name = "all 2"; product p = new product (); p. Name = "ita"; p.Category = 111; p.Discontinued = false; piid = good.NewGuide (); product p1 = New Product (); p1.Name = "Joe"; p1.Category = 222; p1. Disconnected = true; p1.Id = Guid.NewGuid (); P.Products = new System.Collections.Generic.Dictionary & Lt; Guid, SubItem & gt; (); p.Products.Add (sub1.Id, sub1); p.Products.Add (sub2.Id, sub2); p1.Products = new system.collections.Generics.Discision & Lt; Guid, SubItem & gt; (); p1.Products.Add (sub1.Id, sub1);  

I wonder how the current position in this situation is how NIBibernate Reggae dB (what he will prepare a separate table for the sub-object objects?

Edit : I want to be able to create a several several mapping - which will become a separate table with the relevant ID in DB (Product ID, subtitle ID)

Support will be appreciated!

You need to provide the key and index information for the map. [Properties (1, Column = "Product ID")] [Index (2, Column = "Subject Ed.") [Properties (0, Inverted = True)], TypeTip = Type (Guide)] [Ektomi 3, classtype = typef (subtitle)] Public Virtual Dictionary & lt; Guid, SubItem & gt; Product {Received; Set;}


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -