<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : Navigation Property Verification</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Navigation Property Verification</description>
  <pubDate>Wed, 29 Jul 2026 16:58:55 -700</pubDate>
  <lastBuildDate>Tue, 08 Mar 2011 11:18:35 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=2540</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>Navigation Property Verification : Hi smi-mark;I just tested it with...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2540&amp;PID=10133#10133</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2540<br /><strong>Posted:</strong> 08-Mar-2011 at 11:18am<br /><br />Hi smi-mark;<div><br></div><div>I just tested it with the RequiredValueVerifier. And although code generation picked it up, it won't work with navigational property since RequiredValueVerifier deals with null values and a "null" navigational property is not exactly null but rather a "detached/null entity".</div>]]>
   </description>
   <pubDate>Tue, 08 Mar 2011 11:18:35 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2540&amp;PID=10133#10133</guid>
  </item> 
  <item>
   <title>Navigation Property Verification : Hi Denis,I think I tested it with...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2540&amp;PID=10124#10124</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2540<br /><strong>Posted:</strong> 07-Mar-2011 at 9:35pm<br /><br />Hi Denis,<br><br>I think I tested it with the RequiredValueVerifier at first, and since it didn't generate anything for the navigation property, I assumed it didn't work. I'll try it with my null verifier tomorrow. <br><br>Thanks for looking into it.<br><br>]]>
   </description>
   <pubDate>Mon, 07 Mar 2011 21:35:38 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2540&amp;PID=10124#10124</guid>
  </item> 
  <item>
   <title>Navigation Property Verification : Hi smi-mark;I&amp;#039;ve tested the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2540&amp;PID=10122#10122</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2540<br /><strong>Posted:</strong> 07-Mar-2011 at 12:29pm<br /><br />Hi smi-mark;<div><br></div><div>I've tested the buddy class method of adding the verifier and it seems to work for me. Perhaps I misunderstood something specific to your use case?</div><div><br></div><div>Here's my test.</div><div><br></div><div><b>//The NullEntityVerifier</b></div><div><b><br></b></div><div><div>&nbsp;&nbsp; &nbsp;public class NullEntityVerifier : PropertyValueVerifier {</div><div>&nbsp;&nbsp; &nbsp; &nbsp;public NullEntityVerifier(Type entityType, String propertyName,</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;String displayName = null, bool? shouldTreatEmptyStringAsNull = null)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;: base(new PropertyValueVerifierArgs(entityType, propertyName, false,</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;displayName, shouldTreatEmptyStringAsNull)) {</div><div>&nbsp;&nbsp; &nbsp; &nbsp;}</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp;public NullEntityVerifier(PropertyValueVerifierArgs args) : base(args) { }</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp;protected override VerifierResult VerifyValue(object itemToVerify, object valueToVerify,&nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;TriggerContext triggerContext, VerifierContext verifierContext) {</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;var entity = (Entity)valueToVerify;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;var result = !entity.EntityAspect.IsNullEntity;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return new VerifierResult(result);</div><div>&nbsp;&nbsp; &nbsp; &nbsp;}</div><div>&nbsp;&nbsp; &nbsp;}</div></div><div><br></div><div><b>//The NullEntityVerifierAttribute</b></div><div><b><br></b></div><div><div>&nbsp;&nbsp; &nbsp;&#091;AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = false)&#093;</div><div>&nbsp;&nbsp; &nbsp;public class NullEntityVerifierAttribute : PropertyValueVerifierAttribute {</div><div>&nbsp;&nbsp; &nbsp; &nbsp;protected override Verifier BuildVerifierCore(Type pType, String propertyName) {</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return new NullEntityVerifier(</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;new PropertyValueVerifierArgs(pType, propertyName, false, DisplayName,&nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;GetShouldTreatEmptyStringAsNull())</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;);</div><div>&nbsp;&nbsp; &nbsp; &nbsp;}</div><div>&nbsp;&nbsp; &nbsp;}</div></div><div><br></div><div><b>//The buddy class</b></div><div><b><br></b></div><div><div>&nbsp;&nbsp; &nbsp;public class EmployeeMetadata {</div><div><br></div><div>&nbsp;&nbsp; &nbsp; &nbsp;&#091;NullEntityVerifier&#093;</div><div>&nbsp;&nbsp; &nbsp; &nbsp;public static Employee Manager;</div><div>&nbsp;&nbsp; &nbsp;}</div></div><div><br></div><div><b>//The generated code</b></div><div><b><br></b></div><div><div>&nbsp;&nbsp; &nbsp;#region Manager property</div><div><br></div><div>&nbsp;&nbsp; &nbsp;/// &lt;summary&gt;Gets or sets the Manager. &lt;/summary&gt;</div><div>&nbsp;&nbsp; &nbsp;<b>&#091;DomainModel.Employee.NullEntityVerifier&#093;</b></div><div>&nbsp;&nbsp; &nbsp;&#091;Bindable(false)&#093;</div><div>&nbsp;&nbsp; &nbsp;&#091;Display(Name="Manager", AutoGenerateField=false)&#093;</div><div>&nbsp;&nbsp; &nbsp;&#091;DataMember&#093;</div><div>&nbsp;&nbsp; &nbsp;&#091;IbEm.RelationProperty("FK_Employee_Employee", IbEm.QueryDirection.ToRole2)&#093;</div><div>&nbsp;&nbsp; &nbsp;public Employee Manager {</div><div>&nbsp;&nbsp; &nbsp; &nbsp;get { return PropertyMetadata.Manager.GetValue(this); }</div><div>&nbsp;&nbsp; &nbsp; &nbsp;set { PropertyMetadata.Manager.SetValue(this, value); }</div><div>&nbsp;&nbsp; &nbsp;}</div><div>&nbsp;&nbsp; &nbsp;#endregion Manager property</div></div>]]>
   </description>
   <pubDate>Mon, 07 Mar 2011 12:29:05 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2540&amp;PID=10122#10122</guid>
  </item> 
  <item>
   <title>Navigation Property Verification :  Hi smi-mark;We don&amp;#039;t have...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2540&amp;PID=10103#10103</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2540<br /><strong>Posted:</strong> 04-Mar-2011 at 10:50am<br /><br />Hi smi-mark;<div><br></div><div>We don't have an in-built way of doing this. So your verifier solution seems to be perfectly reasonable.&nbsp;</div><div><br></div><div>Let me check on the buddy class method and get back to you.</div><span style="font-size:10px"><br /><br />Edited by DenisK - 04-Mar-2011 at 10:51am</span>]]>
   </description>
   <pubDate>Fri, 04 Mar 2011 10:50:52 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2540&amp;PID=10103#10103</guid>
  </item> 
  <item>
   <title>Navigation Property Verification : Is there an inbuilt way for making...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2540&amp;PID=10096#10096</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 2540<br /><strong>Posted:</strong> 02-Mar-2011 at 5:09pm<br /><br />Is there an inbuilt way for making sure navigation properties are not null? I've done this, but i wondered if there was perhaps a better way.<br><br>&nbsp; public class NullEntityVerifier : PropertyValueVerifier<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public NullEntityVerifier(Type entityType, String propertyName,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String displayName = null, bool? shouldTreatEmptyStringAsNull = null)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : base(new PropertyValueVerifierArgs(entityType, propertyName, false,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; displayName, shouldTreatEmptyStringAsNull))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protected override VerifierResult VerifyValue(object itemToVerify, object valueToVerify, TriggerContext triggerContext, VerifierContext verifierContext)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var entity = (Entity)valueToVerify;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var result = !entity.EntityAspect.IsNullEntity;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return new VerifierResult(result);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp; }<br><br>Then I added this into my provider. I attempted to use the buddy class method to add the verifier but it didn't seem to work, so at this moment in time I have it in my VerifierProvider.<br><br><br><br><br>]]>
   </description>
   <pubDate>Wed, 02 Mar 2011 17:09:05 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2540&amp;PID=10096#10096</guid>
  </item> 
 </channel>
</rss>