tag:blogger.com,1999:blog-6038034264692630628.post2426042379765268218..comments2023-04-11T14:28:06.126+02:00Comments on NOtherDev: Mapping-by-Code - ManyToOneAdam Barhttp://www.blogger.com/profile/16605796098913600806noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-6038034264692630628.post-8956387765589532212019-06-06T08:20:32.803+02:002019-06-06T08:20:32.803+02:00how do I create this TK with "on delete casca...how do I create this TK with "on delete cascade" ? <br /><br />Im using like this but isn't creating with the "on delete cascade"<br /><br /> ManyToOne(o => o.Node, manyToOne =><br /> {<br /> manyToOne.Access(Accessor.NoSetter);<br /> manyToOne.Cascade(Cascade.All | Cascade.DeleteOrphans); <br /> manyToOne.Column("DefinitionNodeId");<br /> manyToOne.Fetch(FetchKind.Join);<br /> manyToOne.Lazy(LazyRelation.NoLazy);<br /> manyToOne.Cascade(Cascade.Persist.Include(Cascade.Remove));<br /> });Thiagohttps://www.blogger.com/profile/02749490781901689972noreply@blogger.comtag:blogger.com,1999:blog-6038034264692630628.post-43986141354751711992013-12-05T20:46:10.327+01:002013-12-05T20:46:10.327+01:00According to this JIRA entry, it is supported from...According to <a href="https://nhibernate.jira.com/browse/NH-2825" rel="nofollow">this JIRA entry</a>, it is supported from 3.3Adam Barhttps://www.blogger.com/profile/16605796098913600806noreply@blogger.comtag:blogger.com,1999:blog-6038034264692630628.post-58261056667311215302013-12-05T14:38:45.067+01:002013-12-05T14:38:45.067+01:00Is property-ref supported now?Is property-ref supported now?Дмитрий Бардаковhttps://www.blogger.com/profile/09697098112834837745noreply@blogger.comtag:blogger.com,1999:blog-6038034264692630628.post-26229402537611595972013-06-21T21:07:43.930+02:002013-06-21T21:07:43.930+02:00It should be supported, it is available in ManyToO...It should be supported, it is available in ManyToOne options. What have you tried?Adam Barhttps://www.blogger.com/profile/16605796098913600806noreply@blogger.comtag:blogger.com,1999:blog-6038034264692630628.post-36124184438798816382013-06-21T11:48:07.537+02:002013-06-21T11:48:07.537+02:00Hi every one,
I use Nhibernate ByCode, and need t...Hi every one, <br />I use Nhibernate ByCode, and need to map a ManyToOne with a formula, but this feature seems not to be supported. Someone has a solution?<br /><br />Thanks in advanceAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-6038034264692630628.post-70573177109317606192013-02-26T12:42:46.521+01:002013-02-26T12:42:46.521+01:00Yes, this is not the mapping-by-code or Guid issue...Yes, this is not the mapping-by-code or Guid issue. You should reference Application class in your entity, not the foreign key id (Guid), which should not be exposed in your model classes. This is how all relationships in NHibernate (and in fact most ORMs) work.Adam Barhttps://www.blogger.com/profile/16605796098913600806noreply@blogger.comtag:blogger.com,1999:blog-6038034264692630628.post-85601629316239105232013-02-26T12:03:14.324+01:002013-02-26T12:03:14.324+01:00Is it possible to sue System.Guid with ManyToOne? ...Is it possible to sue System.Guid with ManyToOne? I've tried this line of code in my mapping<br /><br />ManyToOne(x => x.ApplicationId, map => {map.Column("ApplicationId"); map.NotNullable(true); map.Cascade(Cascade.None); })<br /><br />I get "'System.Guid' must be a reference type in order to use it as <br />parameter 'TProperty'"<br /><br />Where the ApplicationId is a System.Guid. The data structure is the aspnet mebership tables.<br /><br />Is this expected behavior from nhibernate?Chrishttps://www.blogger.com/profile/06817275296074067231noreply@blogger.comtag:blogger.com,1999:blog-6038034264692630628.post-72770542793477397062012-10-24T09:09:05.685+02:002012-10-24T09:09:05.685+02:00Well, it needs either property (name in XML) or fo...Well, it needs either property (<i>name</i> in XML) or formula. See <a href="http://ayende.com/blog/3938/nhibernate-mapping-many-to-one" rel="nofollow">Ayende's great post</a>.Adam Barhttps://www.blogger.com/profile/16605796098913600806noreply@blogger.comtag:blogger.com,1999:blog-6038034264692630628.post-82398600601509606632012-10-23T22:45:18.554+02:002012-10-23T22:45:18.554+02:00Also, I do not understand why ManyToOne requires a...Also, I do not understand why ManyToOne requires a property. The xml mappings do not specify one. Maybe (probably) I am just slow at this time of day!<br /><br />Thanks.Ericnoreply@blogger.comtag:blogger.com,1999:blog-6038034264692630628.post-12155653131917674832012-10-23T22:36:04.992+02:002012-10-23T22:36:04.992+02:00Are there any resources that have real world examp...Are there any resources that have real world examples of how to use mapping by code?Ericnoreply@blogger.com