Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>These partial methods are extension points you can use - if you need and wish to do so:</p> <pre><code>partial void InsertPerson(Person instance); </code></pre> <p>This means, you can - if you wish - implement a function that gets called each time a <code>Person</code> object is being inserted in your data context.</p> <p>A partial function will be removed by the linker if it's not been implemented in any way - so there's no performance penalty of any kind.</p> <p>However, <strong>if</strong> you implement it, it will be called and can be used to tweak the way the system behaves.</p> <pre><code>partial void OnLastNameChanging(string value); partial void OnLastNameChanged(); </code></pre> <p>For each property on your entities, you'll get two partial methods that allow you to hook into a time just before your property gets changed (<code>OnLastNameChanging</code>), or just after the change has been made (<code>OnLastNameChanged</code>). You'd use the first method typically for validation - check the new validation and throw an exception if you don't like it for some reason.</p> <p>You'd use the second method typically to do additional housekeeping or updating other properties, once your "lastname" has been changed.</p> <p>Partial methods are a new C# 3.0 (.NET 3.5) feature - read more about them <a href="http://geekswithblogs.net/sdorman/archive/2007/12/24/c-3.0---partial-methods.aspx" rel="nofollow noreferrer">here</a> and <a href="http://community.bartdesmet.net/blogs/bart/archive/2007/07/28/c-3-0-partial-methods-what-why-and-how.aspx" rel="nofollow noreferrer">here</a>.</p> <p>Marc</p>
 

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