Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I find out desition.<br> Mapping:</p> <pre><code>&lt;class name="User" table="Users" lazy="false"&gt; &lt;id name="id" type="Int32" column="id"&gt; &lt;generator class="identity" /&gt; &lt;/id&gt; &lt;property name="name" column="name" type="String"/&gt; &lt;map name="Urls" lazy="true" cascade="all-delete-orphan" inverse="true"&gt; &lt;key column="user_id"&gt;&lt;/key&gt; &lt;index column="im_type_id" type="Int32"/&gt; &lt;one-to-many class="UserUrl"/&gt; &lt;/map&gt; &lt;/class&gt; &lt;class name="UserUrl" table="UserUrl"&gt; &lt;id name="id" type="Int32" column="id"&gt; &lt;generator class="identity"/&gt; &lt;/id&gt; &lt;property name="user_id" column="user_id" type="Int32"/&gt; &lt;property name="UrlType" column="url_type_id" type="Int32" not-null="true" /&gt; &lt;property name="Url" column="url" type="String" not-null="true"/&gt; &lt;/class&gt; </code></pre> <p>Code: </p> <pre><code>public sealed class UrlType { private const string _Facebook = "Facebook"; private const string _Myspace = "Myspace"; private const string _Youtube = "Youtube"; public static readonly int Facebook; public static readonly int Myspace; public static readonly int Youtube; static UrlType() { Facebook = FindByName(_Facebook).Id; Myspace = FindByName(_Myspace).Id; Youtube = FindByName(_Youtube).Id; } } </code></pre> <p>Use: </p> <pre><code>User curUser = FindById(2); string facebookUrl = curUser.Urls[UrlType.Facebook].Url; </code></pre> <p>But It is spend more time to get ids of Urls types from DB</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload