<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx</link><description>In the last few posts on LINQ to SQL I've showed how to set up an object model using the O/R designer and how to handle a couple data binding scenarios with Comboboxes here and here . Last post on this topic we implemented a one-to-many data entry form</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>BioSensorAB &amp;raquo; Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#7897825</link><pubDate>Tue, 26 Feb 2008 04:20:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7897825</guid><dc:creator>BioSensorAB » Simple Validation with LINQ to SQL Classes</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.biosensorab.org/2008/02/25/simple-validation-with-linq-to-sql-classes/"&gt;http://www.biosensorab.org/2008/02/25/simple-validation-with-linq-to-sql-classes/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>LINQ to SQL クラスにデータのチェックを追加する</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#7899511</link><pubDate>Tue, 26 Feb 2008 08:01:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7899511</guid><dc:creator>どっとねっとふぁんBlog</dc:creator><description>&lt;p&gt;Simple Validation with LINQ to SQL Classes LINQ to SQLクラスを拡張し、Windowsアプリのデータチェック機能と連動させる方法がまとめられています。...&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#7904031</link><pubDate>Tue, 26 Feb 2008 16:44:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7904031</guid><dc:creator>karl1406</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;Fantastic article. &amp;nbsp;You are a SUPER teacher.&lt;/p&gt;
&lt;p&gt;Question: &amp;nbsp;What is your approach to the problem of using generated entity classes that require custom attributes?&lt;/p&gt;
&lt;p&gt;Example: &amp;nbsp;How would you implment the Enterprise VALIDATION application block with the generated classes? &amp;nbsp;&lt;/p&gt;
&lt;p&gt;The VAB requires attributes be applied to individual properties. &amp;nbsp;Since the designer is creating the entity classes and we are being told not to mess with these, how can we get the attributes on the enitity properties?&lt;/p&gt;
&lt;p&gt;Best to you.&lt;/p&gt;
&lt;p&gt;Karl&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#7906960</link><pubDate>Tue, 26 Feb 2008 20:23:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7906960</guid><dc:creator>rogerj</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;Great tutorial!&lt;/p&gt;
&lt;p&gt;Your tutorials have become to VB projects what Scott Guthrie's are to C# and ASP.NET projects.&lt;/p&gt;
&lt;p&gt;--rj&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#7908007</link><pubDate>Tue, 26 Feb 2008 21:21:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7908007</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Karl,&lt;/p&gt;
&lt;p&gt;You can actually create your own business classes and have them work with the DataContext manually so you don't need to have the O/R designer generate the classes if you don't want. That gives you complete control. Jim Wooley has some great examples in these webcasts:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.aspnetpodcast.com/VideoFiles/ASPNETPodcast20070628-LINQPart1WithJimWooley.wmv"&gt;http://www.aspnetpodcast.com/VideoFiles/ASPNETPodcast20070628-LINQPart1WithJimWooley.wmv&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.aspnetpodcast.com/VideoFiles/ASPNETPodcast20070708-LINQPart2WithJimWooley.wmv"&gt;http://www.aspnetpodcast.com/VideoFiles/ASPNETPodcast20070708-LINQPart2WithJimWooley.wmv&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.aspnetpodcast.com/VideoFiles/ASPNETPodcast20070711-LINQPart3WithJimWooley.wmv"&gt;http://www.aspnetpodcast.com/VideoFiles/ASPNETPodcast20070711-LINQPart3WithJimWooley.wmv&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#7908008</link><pubDate>Tue, 26 Feb 2008 21:22:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7908008</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Roger,&lt;/p&gt;
&lt;p&gt;THANKS!&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#7935078</link><pubDate>Thu, 28 Feb 2008 16:59:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7935078</guid><dc:creator>karl1406</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;I'm hoping to be able to use the VS 2008 O/R Designer. &amp;nbsp;A lot of work went into this tool and it does a good job of generating business layer entities that are extendable.&lt;/p&gt;
&lt;p&gt;I can ripe all my business layer code apart and remove the codeless declarations that drive it and place similar code in methods. &amp;nbsp;In other words, no longer use attributes and place the rules in code. &amp;nbsp;I'm OK with this.&lt;/p&gt;
&lt;p&gt;Doing this will make my Partial class compatbile with the VS O/R classes.&lt;/p&gt;
&lt;p&gt;However, I have one issue that I'm hoping you can provide some direction so that I can take this business layer I've written and use it with the VS O/R code.&lt;/p&gt;
&lt;p&gt;I have posted a question on the LINQ forum.&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2920231&amp;amp;SiteID=1"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2920231&amp;amp;SiteID=1&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Basically I need to be able to make one VERY minor change to the code that is outputted. &amp;nbsp;Basically, I need to pass the OnChanging ByRef instead of ByVal so that my business layer can alter the inputted value. &amp;nbsp;My business layer adjusts the case of the text based on business rules. &amp;nbsp;This is the be location that I could find to inject this behavior.&lt;/p&gt;
&lt;p&gt;I'm hoping that there is a template somewhere that can be modified. &amp;nbsp;I looked but could find one.&lt;/p&gt;
&lt;p&gt;I know that I can purchase Code Smith, write the classes by hand or generate them myself, I'm just hoping that there is a way to integrate the classes with what VS generates.&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#7936496</link><pubDate>Thu, 28 Feb 2008 20:25:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7936496</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Karl,&lt;/p&gt;
&lt;p&gt;You can achieve the same results by adding the code that modifies the property into the On...Changed() partial method. For instance, in the above example for my customer partial class I could write it like this:&lt;/p&gt;
&lt;p&gt;Partial Class Customer&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Inherits BaseBusiness&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Private Sub OnLastNameChanging(ByVal value As String)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.CheckLastName(value)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Private Sub OnValidate(ByVal action As System.Data.Linq.ChangeAction)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.CheckLastName(Me.LastName)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If Me.HasErrors Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Throw New ValidationException(Me.Error)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Private Sub CheckLastName(ByRef value As String)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If String.IsNullOrEmpty(value) Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.AddError(&amp;quot;LastName&amp;quot;, &amp;quot;Customer name cannot be empty.&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.RemoveError(&amp;quot;LastName&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;value = value.ToUpper&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Private Sub OnLastNameChanged()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me._LastName = Me.LastName.ToUpper&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt;End Class&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#7936798</link><pubDate>Thu, 28 Feb 2008 21:39:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7936798</guid><dc:creator>karl1406</dc:creator><description>&lt;p&gt;Beth, &lt;/p&gt;
&lt;p&gt;Thank you very much for a SUPER fast response and great example. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;When I looked at the entity classes that were generated, with all the private _LastName variables, my brain didn't connect the dots that I had access to then in my partial class. &amp;nbsp;(ooooops).&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Karl&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#7988262</link><pubDate>Sun, 02 Mar 2008 13:36:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7988262</guid><dc:creator>Courtney Smith</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;I've just started using Linq and VB.NET and have to say your tutorials are an excellent source of information!&lt;/p&gt;
&lt;p&gt;I was just wondering if you've come across a problem with partial classes and the object datasource.&lt;/p&gt;
&lt;p&gt;Eg. &lt;/p&gt;
&lt;p&gt; - Create a Linq-SQL Entity with the OR tool.&lt;/p&gt;
&lt;p&gt; - Add a new property to the partial class for the entity.&lt;/p&gt;
&lt;p&gt; - Create an object datasource for that Entity&lt;/p&gt;
&lt;p&gt;In the object datasource the new property is not shown. &amp;nbsp;It seems to only be displayed if I add it directly to the designer file (which then automatically gets removed at times).&lt;/p&gt;
&lt;p&gt;Am I doing something wrong? &amp;nbsp;Is there something special I have to do to get the properties from the partial class to show in the object datasource?&lt;/p&gt;
&lt;p&gt;Thanks for your help.&lt;/p&gt;
&lt;p&gt;Kind Regards,&lt;/p&gt;
&lt;p&gt;Courtney&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8025449</link><pubDate>Tue, 04 Mar 2008 15:13:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8025449</guid><dc:creator>K.HABTAY</dc:creator><description>&lt;p&gt;I WANT TO LEARN MORE ABOUT YOUR EXPERIENCE AS SYSTEMS SPECAILIST &amp;nbsp;FOR I AM JUST BEGINNING TO LEARN ABOUT THIS SUBJECT.&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8372978</link><pubDate>Wed, 09 Apr 2008 21:32:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8372978</guid><dc:creator>Josh F</dc:creator><description>&lt;p&gt;Pulling my hair out. Using VS 2008, the generated classes do not implement INotify*. Any help is greatly appreciated.&lt;/p&gt;
</description></item><item><title>LINQ to SQL N-Tier Smart Client - Part 1 Building the Middle-Tier</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8385508</link><pubDate>Sat, 12 Apr 2008 19:27:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8385508</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;In my previous posts on LINQ to SQL I showed how to build LINQ to SQL classes and set up the data binding&lt;/p&gt;
</description></item><item><title>LINQ to SQL N-Tier Smart Client - Part 2 Building the Client</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8393820</link><pubDate>Mon, 14 Apr 2008 21:08:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8393820</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;In my last post we built the service and data access layer for our LINQ to SQL N-Tier application. In&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8415193</link><pubDate>Mon, 21 Apr 2008 22:07:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8415193</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Josh,&lt;/p&gt;
&lt;p&gt;Are you using the RTM version of VS 08 (not beta, right)? If so, when you &amp;quot;Add New Item&amp;quot; to your project and select &amp;quot;Linq to SQL Classes&amp;quot;, then drag a SQL-Server table onto the design surface it will generate the class definition in the designer file. (You need to &amp;quot;show all files&amp;quot; to see this file). The interfaces are implemented there. Are you sure you aren't looking in the partial class file (where your custom code belongs)?&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8417145</link><pubDate>Tue, 22 Apr 2008 22:53:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8417145</guid><dc:creator>Brian Ilyas</dc:creator><description>&lt;p&gt;Great work. &lt;/p&gt;
&lt;p&gt;There are couple of issues, when you add new record error info does not show up. &lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8423044</link><pubDate>Fri, 25 Apr 2008 02:33:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8423044</guid><dc:creator>Matthew from Sydney</dc:creator><description>&lt;p&gt;I had already written something similar to your BaseBusiness class except I was using a generic list rather than the dictionary object. &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Public ColumnErrors As New List(Of ColumnError)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Public Class ColumnError&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Public PropertyName As String&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Public ErrorText As String&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Class&lt;/p&gt;
&lt;p&gt;I have now changed my code now to use the dictionary object which I think is much more elegant - thanks for that!&lt;/p&gt;
&lt;p&gt;I have used ADO.NET heavily until Linq to SQL arrived in VB9 and vastly prefer this approach for the data layer.&lt;/p&gt;
&lt;p&gt;Beth, I enjoy reading you fantastic blogs - keep up the good work!&lt;/p&gt;
&lt;p&gt;-Matt&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8455011</link><pubDate>Sat, 03 May 2008 16:15:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8455011</guid><dc:creator>Brian in England</dc:creator><description>&lt;p&gt;Ok so we can validate, but how can we set defaults for new rows? &lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8463586</link><pubDate>Tue, 06 May 2008 21:05:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8463586</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Brian,&lt;/p&gt;
&lt;p&gt;It depends on how you implement the list of business objects. In this example I'm just setting the results of the query directly to the DataSource so there is no default behavior. If you place the results of the query into your own subclass of the BindingList for instance, then you can override the AddNewCore method. &lt;/p&gt;
&lt;p&gt;This is the same principle as normal object binding to your collections of business objects. Here's one of my favorite books on data binding: &lt;a rel="nofollow" target="_new" href="http://www.amazon.com/Data-Binding-Windows-Forms-2-0/dp/032126892X"&gt;http://www.amazon.com/Data-Binding-Windows-Forms-2-0/dp/032126892X&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8484266</link><pubDate>Sat, 10 May 2008 21:59:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8484266</guid><dc:creator>Josh F</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;Thank you for the reply, and I apologize for the long delay.&lt;/p&gt;
&lt;p&gt;Yes, I'm using VS 2008 RTM. And, yes, I'm looking at the designer file. Still losing hair!&lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;Josh&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8484318</link><pubDate>Sat, 10 May 2008 22:26:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8484318</guid><dc:creator>Beth</dc:creator><description>&lt;p&gt;After adding a primary key to my table, the code generated the INotify* implementation.&lt;/p&gt;
&lt;p&gt;Thanks again,&lt;/p&gt;
&lt;p&gt;Josh&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8494208</link><pubDate>Mon, 12 May 2008 16:52:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8494208</guid><dc:creator>MikeBB</dc:creator><description>&lt;p&gt;Hi! I am sorry bad english. How validate work if i delete row&lt;/p&gt;
&lt;p&gt;Orders.DeleteOnSubmit(dtl_item);&lt;/p&gt;
&lt;p&gt;How recognize row state in LINQ? But delete row don't validate!&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8499103</link><pubDate>Tue, 13 May 2008 09:20:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8499103</guid><dc:creator>MikeBB</dc:creator><description>&lt;p&gt;Hi! Validate and delete row. If use ADO.Net we write validate code ( that makr before save)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;foreach (DataSet.SchetRow row in Schet.Rows)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;switch (row.RowState)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case DataRowState.Added:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;case DataRowState.Modified:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;row.ClearErrors();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (row.Isrsh_numNull())&lt;/p&gt;
&lt;p&gt;h. e. we don't validate delete row! How true validate in LINQ?&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8504928</link><pubDate>Thu, 15 May 2008 00:53:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8504928</guid><dc:creator>pat</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;do you have an example to implement on an asp.net page?&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8507133</link><pubDate>Thu, 15 May 2008 11:41:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8507133</guid><dc:creator>MikeBB</dc:creator><description>&lt;p&gt;Hi Beth! May be you don't understand me? You make test&lt;/p&gt;
&lt;p&gt;1. Edit master- detail documnet&lt;/p&gt;
&lt;p&gt;2 In detail part add some row and delete theirs&lt;/p&gt;
&lt;p&gt;3 if detail class has validation&lt;/p&gt;
&lt;p&gt; &amp;nbsp;partial class detail&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partial void OnamountChanging(decimal? value)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Checked_amount(value);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;private void Checked_amount(decimal? value)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;partial void OnValidate(ChangeAction action)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Checked_amount(this.amount);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (HasErrod)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;throw new Exception(&amp;quot;No amount&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;4. Save document&lt;/p&gt;
&lt;p&gt;datacontext.SubmitChanges();&lt;/p&gt;
&lt;p&gt;5 This method call &amp;nbsp;OnValidate and delete row are present in process validate!!!&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8508014</link><pubDate>Thu, 15 May 2008 16:41:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8508014</guid><dc:creator>MikeBB</dc:creator><description>&lt;p&gt;In Entity Framework row state present!&lt;/p&gt;
&lt;p&gt;foreach (NaklModel.NaklDtl o in CurrentHdr.NaklDtl) &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var state = context.ObjectStateManager.GetObjectStateEntry(o.EntityKey);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MessageBox.Show(&lt;/p&gt;
&lt;p&gt;String.Format(&amp;quot;{0}={1}&amp;quot;,&lt;/p&gt;
&lt;p&gt;state.EntityKey.EntityKeyValues[0] , state.State));&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8512992</link><pubDate>Fri, 16 May 2008 16:07:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8512992</guid><dc:creator>Carlos</dc:creator><description>&lt;p&gt;Hey Beth,&lt;/p&gt;
&lt;p&gt;Good article. &amp;nbsp;I have a question with regards to using this technique with WCF.&lt;/p&gt;
&lt;p&gt;If I implement IDataErrorInfo on an entity in my datacontext and then use that entity in a WCF WebMethod, that same entity on the service consumer does not implement IDataErrorInfo. &amp;nbsp;Is there a way to do this? &amp;nbsp; I'd like to define my validation rules on the business entity generated by LINQ's ORM but through a web service consumed by a XBAP.&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8662672</link><pubDate>Fri, 27 Jun 2008 22:33:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8662672</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Carlos, &lt;/p&gt;
&lt;p&gt;The only way to do this is to use Type Sharing. (Add a reference to your business object entities and then add the Service Reference). But this solution only works if your client and service are both .NET. It's not SOA. &lt;/p&gt;
&lt;p&gt;I don't have much experiance with XBAP but I think it would work.&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>Displaying Data Validation Messages in WPF</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8663005</link><pubDate>Sat, 28 Jun 2008 01:58:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8663005</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;As you can probably tell from my last couple posts I've been working with WPF in different data scenarios.&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8763677</link><pubDate>Tue, 22 Jul 2008 14:13:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8763677</guid><dc:creator>hip london</dc:creator><description>&lt;p&gt;Hi! do you have an example to implement on an asp.net page?&lt;/p&gt;
&lt;p&gt;thanks for answer bye :)&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8764758</link><pubDate>Tue, 22 Jul 2008 23:00:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8764758</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi hip london,&lt;/p&gt;
&lt;p&gt;ScottGu has a lot of posts on this subject. Try this feed: &lt;a rel="nofollow" target="_new" href="http://weblogs.asp.net/scottgu/archive/tags/LINQ/ASP.NET/SQL+Server/default.aspx"&gt;http://weblogs.asp.net/scottgu/archive/tags/LINQ/ASP.NET/SQL+Server/default.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>Validation Method Timing in LINQ To SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8841669</link><pubDate>Thu, 07 Aug 2008 23:47:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8841669</guid><dc:creator>Hilton Giesenow's Jumbled Mind</dc:creator><description>&lt;p&gt;The LINQ To SQL designer-generated classes contain 3 different ways to implement validation based on&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8843693</link><pubDate>Fri, 08 Aug 2008 18:41:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8843693</guid><dc:creator>James Poll</dc:creator><description>&lt;p&gt;Thanks for a super article. &amp;nbsp;One question though. &amp;nbsp;I want to put some business logic and rules into the classes linqtosql generated by using the partial 'changing' methods. &amp;nbsp;However, these methods also fire when the linqtosql object is being populated from the database. &amp;nbsp;Is there a way to work out in the 'changing' method wether or not the change of the property was set by the database or not?&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8849432</link><pubDate>Tue, 12 Aug 2008 02:16:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8849432</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi James,&lt;/p&gt;
&lt;p&gt;Take a look at the OnLoaded method. I think that is called when the database values are being populated. You may be able to set a flag in there. &lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>Displaying Data Validation Messages in WPF</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#8921470</link><pubDate>Wed, 03 Sep 2008 09:58:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8921470</guid><dc:creator>He,YuanHui - khler</dc:creator><description>&lt;p&gt;Displaying Data Validation Messages in WPF&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9015248</link><pubDate>Sat, 25 Oct 2008 00:04:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9015248</guid><dc:creator>Mark V</dc:creator><description>&lt;p&gt;Beth, Very nice. I like but...&lt;/p&gt;
&lt;p&gt;In the code below you show how to validate the CustomerID. My question is where are you checking that the CustomerId is an integer? What if this is a text box field on a web page that allows the user enter anything they want? Are you depending on a validator on the web page to catch this?&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Private Sub CheckCustomerID(ByVal value As Integer)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If value &amp;lt; 1 Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.AddError(&amp;quot;CustomerID&amp;quot;, &amp;quot;Customer cannot be empty.&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.RemoveError(&amp;quot;CustomerID&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9053139</link><pubDate>Sat, 08 Nov 2008 00:56:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9053139</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Mark,&lt;/p&gt;
&lt;p&gt;The CustomerID Property is defined as an Integer so by the time we get to this validator the property setter is running. You should restrict the input on the textbox or binding itself on the client as well.&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9135765</link><pubDate>Mon, 24 Nov 2008 07:25:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9135765</guid><dc:creator>LeongChun</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;This really a fantastic guidelines for me as a beginner in N-Tier Application.&lt;/p&gt;
&lt;p&gt;At least, now, i'm able to view to whole picture of N-Tier Layer &amp;amp; neccessary code &amp;amp; objects involved.&lt;/p&gt;
&lt;p&gt;I can't go far just refering to MSDN guidelines.&lt;/p&gt;
&lt;p&gt;Thanks to you!&lt;/p&gt;
&lt;p&gt;-LC&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9335772</link><pubDate>Sat, 17 Jan 2009 13:23:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9335772</guid><dc:creator>Jure</dc:creator><description>&lt;p&gt;Hello Beth,&lt;/p&gt;
&lt;p&gt;Thanks for a great manual, but i have a small problem: the OnChanging or any other events are never called from the Linq.dbml. I tried a simple test with OnLoaded (with a msgbox) and it doesnt show. Everything else though works fine. The data is loaded, I can change it, delete it or add new data. Does it have something to do with the fact that i have an SQLExpress database? Im desperate :S &lt;/p&gt;</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9817304</link><pubDate>Sat, 04 Jul 2009 08:31:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9817304</guid><dc:creator>Rodrigo</dc:creator><description>&lt;p&gt;Hi Beth! &lt;/p&gt;
&lt;p&gt;great article, but i been looking a way to validate duplicate data, I mean, when added a new record i want to check if is exist, it works (doing a query directly to the database trough linq). but what happen if i have a then thousands of records?, the performance goes down (i think) there is any way to do this directly trough the datacontext &amp;nbsp;because i'm little confuse with linq (i newbie with it) or just be a problem between the keyboard and the chair?&lt;/p&gt;
&lt;p&gt;thanks.. x)&lt;/p&gt;</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9823161</link><pubDate>Wed, 08 Jul 2009 00:29:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9823161</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Rodrigo,&lt;/p&gt;
&lt;p&gt;As long as you have proper indexes set up on the database on the fields you are querying and you are also limiting the results with a Where clause, then the query will perform well. However you may want to validate them all in one query when SubmitChanges is called rather than everytime a new item is added. &lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9835237</link><pubDate>Thu, 16 Jul 2009 10:15:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9835237</guid><dc:creator>Gunasundari</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I want the explanation of LINQ to SQL and how to use&lt;/p&gt;
&lt;p&gt;it in asp.net 2.0 programming wise..&lt;/p&gt;
&lt;p&gt;Have a Great day!.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Guna Sundari.&lt;/p&gt;</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9835867</link><pubDate>Thu, 16 Jul 2009 20:31:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9835867</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Gunasundari,&lt;/p&gt;
&lt;p&gt;Check out ScottGu's blog posts on this topic:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://weblogs.asp.net/scottgu/archive/2007/08/27/linq-to-sql-part-8-executing-custom-sql-expressions.aspx"&gt;http://weblogs.asp.net/scottgu/archive/2007/08/27/linq-to-sql-part-8-executing-custom-sql-expressions.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;or visit www.asp.net&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9843257</link><pubDate>Tue, 21 Jul 2009 14:50:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9843257</guid><dc:creator>Matt</dc:creator><description>&lt;p&gt;Beth&lt;/p&gt;
&lt;p&gt;I am unable to get the error provider to show.&lt;/p&gt;
&lt;p&gt;Here is my scenario:&lt;/p&gt;
&lt;p&gt;I am using a user control, stored procs and multiple projects opposed to yours where you do it on one. &amp;nbsp;I am able to add errors to the validation exception but I am unable to get the error provider to show. &lt;/p&gt;
&lt;p&gt;Any insight?&lt;/p&gt;</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9843788</link><pubDate>Tue, 21 Jul 2009 23:00:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9843788</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Matt,&lt;/p&gt;
&lt;p&gt;Check to make sure you set up your partial classes like I explained above. Call your validation code from the xxxChanging events and make sure you add the error strings to the dictionary (AddError) before xxxChanged events are fired. You'll also need to make sure that the ErrorProvider's datasource is set to the same BindingSource that your controls are bound to. If you are referencing the project that contains your partial LINQ to SQL types directly this should work fine. If you are building an n-tier application and have a service layer in between your client and data access layers you'll need to either write the validation on the client proxy types or share the LINQ to SQL types on the client and service projects. You can see this post for an example of how to share types on the client and server: &lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/bethmassi/archive/2008/04/14/linq-to-sql-n-tier-smart-client-part-2-building-the-client.aspx"&gt;http://blogs.msdn.com/bethmassi/archive/2008/04/14/linq-to-sql-n-tier-smart-client-part-2-building-the-client.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9878096</link><pubDate>Fri, 21 Aug 2009 07:49:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9878096</guid><dc:creator>Suraj</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;I am able to show the errrors through the error provider.But at the same time i have to show the error message in the status bar of the corresponding form also.How can i get errors from the base business or from the Idataerrorinformation.how can i make it possible.Please help me&lt;/p&gt;
&lt;p&gt;Any insight?&lt;/p&gt;
&lt;p&gt;Suraj&lt;/p&gt;</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9879149</link><pubDate>Fri, 21 Aug 2009 22:26:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9879149</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Suraj,&lt;/p&gt;
&lt;p&gt;You're free to write your own implementation of the IDataErrorInfo. You could expose a method or property to return the collection of errors on your business object. You may also just want to create your own ErrorProvider that exposes the collection of errors.&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9879319</link><pubDate>Sat, 22 Aug 2009 00:19:47 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9879319</guid><dc:creator>mahad</dc:creator><description>&lt;p&gt;hi beth massi really you are supportede many sides of may sofftware porject by watvhing your vedio traing but cant get still the trading which about how you store and save picture inside table and then displays picturebox and you point out me and please help me how do this problem&lt;/p&gt;</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9880547</link><pubDate>Sat, 22 Aug 2009 17:43:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9880547</guid><dc:creator>Suraj</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;Thank you for the reply.I have one more problem in the entity class. I have to check if a row is already inserted.i tried the following code but it fired an error&lt;/p&gt;
&lt;p&gt;that&amp;quot;System.NullReferenceException: Object reference not set to an instance of an object&amp;quot;&lt;/p&gt;
&lt;p&gt;code snippet &lt;/p&gt;
&lt;p&gt;Partial Class LeaveSetupDetail&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Inherits BaseBusiness&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Private Sub OnLeaveTypeIDChanging(ByVal value As Integer)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.CheckLeaveTypeID(value)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Private Sub CheckLeaveTypeID(ByVal value As Integer)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If value &amp;lt; 1 Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.AddError(&amp;quot;LeaveTypeID&amp;quot;, &amp;quot;Leave Type Cannot be Empty&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.RemoveError(&amp;quot;LeaveTypeID&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim i As Int32&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim s = From d In LeaveSetupMaster.LeaveSetupDetails _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Select d.LeaveTypeID&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim flag As Boolean&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;For Each i In s&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If value = i Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Flag = True&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Next&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If flag = True Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.AddError(&amp;quot;LeaveTypeID&amp;quot;, &amp;quot;Leave Type Already Exists&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Else&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.RemoveError(&amp;quot;LeaveTypeID&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt;end class&lt;/p&gt;
&lt;p&gt;Pls give a solution&lt;/p&gt;
&lt;p&gt;thanks,&lt;/p&gt;
&lt;p&gt;suraj&lt;/p&gt;</description></item><item><title>re: Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/25/simple-validation-with-linq-to-sql-classes.aspx#9942355</link><pubDate>Wed, 30 Dec 2009 18:07:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9942355</guid><dc:creator>Devin</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;First off, I have say you have made my life as a programmer so much simpler. &amp;nbsp;I love your articles and how-to videos.&lt;/p&gt;
&lt;p&gt;Ok...I have coded everything as you have it here, but I keep getting an error when throwing the exception. &amp;nbsp;The app halts immediately after the exception is thrown with an &amp;quot;Exception is unhandled by user code&amp;quot;. &amp;nbsp; I have Try/Catch blocks around the calling code and I have been unable to dublicate this error outside of this scenario. &amp;nbsp;Any ideas?&lt;/p&gt;
</description></item></channel></rss>