﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Business Objects and Data Access (How do I?)  » Exception with Extended Properties</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Thu, 04 Jun 2026 20:07:55 GMT</lastBuildDate><ttl>20</ttl><item><title>Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost15238.aspx</link><description>I've an extended property called ClientAccountName. When I fill the Business Object which based on table mt_pch_companies, An exception was thrown. What should I do ? &lt;/P&gt;&lt;P&gt;Exception :&lt;/P&gt;&lt;P&gt;Column 'ClientAccountName' does not belong to table mt_pch_companies.</description><pubDate>Sat, 24 May 2008 03:18:47 GMT</pubDate><dc:creator>Ertan Deniz</dc:creator></item><item><title>RE: Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost16566.aspx</link><description>I had thought that I had to write for every property of a class to ensure specified column exist in CurrentDataTable.&lt;/P&gt;&lt;P&gt;But It was only for extended properties. So, It is not hard to write.</description><pubDate>Sat, 24 May 2008 03:18:47 GMT</pubDate><dc:creator>Ertan Deniz</dc:creator></item><item><title>RE: Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost16549.aspx</link><description>No, not really.&amp;nbsp; What do you mean?&amp;nbsp; I already gave you my comment on the previous post. :)</description><pubDate>Fri, 23 May 2008 09:34:12 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost16548.aspx</link><description>Any comment ?</description><pubDate>Fri, 23 May 2008 07:26:36 GMT</pubDate><dc:creator>Ertan Deniz</dc:creator></item><item><title>RE: Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost16484.aspx</link><description>[quote]&lt;SPAN id=ctl02_ctlTopic_ctlPanelBar_ctlTopicsRepeater_ctl22_lblFullMessage&gt;Any comment ? I 'm trying to find easy way ? (Shared) Central point to write the code. (EnsureColumnsExist)&lt;/SPAN&gt; [/quote]&lt;P&gt;I generally do this immediately after calling a Fill ... or even in some cases an Add since those columns would not exist on the Add.&amp;nbsp; This really is up to you and depends on if this is an isolated element of a single maintenance form or will happen for the entire BO no matter where it is used.&lt;/P&gt;&lt;P&gt;If it is the latter, then you may want to override the FillDataTable method on your BO.&amp;nbsp; Then call this method after you call the MyBase.FillDataTable(...) method.&amp;nbsp;</description><pubDate>Wed, 21 May 2008 09:16:56 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost16478.aspx</link><description>Any comment ? I 'm trying to find easy way ? (Shared) Central point to write the code. (EnsureColumnsExist)</description><pubDate>Wed, 21 May 2008 09:02:56 GMT</pubDate><dc:creator>Ertan Deniz</dc:creator></item><item><title>RE: Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost16461.aspx</link><description>Where is the place of this method called in the code ? You said when referencing a column.&lt;/P&gt;&lt;P&gt;Should you give me an explanation ?&amp;nbsp;</description><pubDate>Tue, 20 May 2008 00:59:09 GMT</pubDate><dc:creator>Ertan Deniz</dc:creator></item><item><title>RE: Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost16440.aspx</link><description>Thanks.</description><pubDate>Mon, 19 May 2008 09:00:12 GMT</pubDate><dc:creator>Ertan Deniz</dc:creator></item><item><title>RE: Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost16437.aspx</link><description>Well, I see your point, and&amp;nbsp;this is actually by design.&amp;nbsp; You are wanting to perform a query, and then the internal ADO.NET table to automatically have all of the columns for the table.&amp;nbsp; This is not how the logic of a BO works.&amp;nbsp; It expects those columns to be included within the query or to be defined.&amp;nbsp; In our medical software, we actually have a shared method that ensures that columns and their default values exist in the case that we attempt to reference it, etc.&amp;nbsp; It looks something like this:&lt;/P&gt;&lt;P&gt;[codesnippet]&amp;nbsp;&amp;nbsp;&amp;nbsp; ''' &amp;lt;summary&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''' Ensures that the column specified exists within the table.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''' &amp;lt;/summary&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''' &amp;lt;param name="table"&amp;gt;&amp;lt;/param&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''' &amp;lt;param name="columnName"&amp;gt;&amp;lt;/param&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''' &amp;lt;param name="columnType"&amp;gt;&amp;lt;/param&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''' &amp;lt;param name="defaultValue"&amp;gt;&amp;lt;/param&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ''' &amp;lt;remarks&amp;gt;&amp;lt;/remarks&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Shared Sub EnsureColumnExists(ByVal table As DataTable, ByVal columnName As String, ByVal columnType As System.Type, ByVal defaultValue As Object)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Establish Locals&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim col As DataColumn&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim columnFound As Boolean = False&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Cycle through all of the columns so we can test on a case-insensitive basis&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; For Each col In table.Columns&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Check to see if the column name matches&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; columnFound = col.ColumnName.Equals(columnName, StringComparison.OrdinalIgnoreCase)&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; '-- If the column was found, exit&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If columnFound Then Exit For&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Next&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- See if there is any reason to continue&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If columnFound Then Exit Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- If we make it to this point, then we have a hit&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col = New DataColumn(columnName, columnType)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col.DefaultValue = defaultValue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '-- Add the column to the table&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; table.Columns.Add(col)&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub[/codesnippet]</description><pubDate>Mon, 19 May 2008 08:36:00 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost16422.aspx</link><description>protected override FieldPropertyDescriptor[] GetCustomBindablePropertyDescriptors()&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;return new FieldPropertyDescriptor[] &lt;/P&gt;&lt;P&gt;{ &lt;/P&gt;&lt;P&gt;new ReflectionPropertyDescriptor("ClientAccountName", typeof(Companies)),&lt;/P&gt;&lt;P&gt;new ReflectionPropertyDescriptor("GroupName", typeof(Companies))&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;I 've written the code necessary for the extended properties. The problem is that When we does not select any property (predefined or exteneded) with our query. Business object's table contains only selected columns. Business object is bound to a grid through BBS. Business object contains all the property definitions but table contains only selected ones. This is the central of the problem. After selecting a record on the grid, When we press a button, an exception is thrown. This exception is catched by the InvalidRowException event of the Devexpress Grid. Internally, there is an access to the properties of the business object that is not selected to be shown on the grid. We don't select them because there is no need to show.&lt;/P&gt;&lt;P&gt;This is the my case in detail.</description><pubDate>Sat, 17 May 2008 01:14:14 GMT</pubDate><dc:creator>Ertan Deniz</dc:creator></item><item><title>RE: Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost16410.aspx</link><description>Binding requires that you provide a type descriptor...I recommend doing a search on GetCustomBindablePropertyDescriptors....there should be a ton of posts on this.&amp;nbsp; Bottom line is that if you attempt to bind to a column that does not have a descriptor, you will get an error.</description><pubDate>Fri, 16 May 2008 10:41:16 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost16400.aspx</link><description>I had problems with extended columns. At this time, The exception that I have got&amp;nbsp;was related to binding.&lt;/P&gt;&lt;P&gt;I have not bound the extended column (A) to the grid. But When navigating in the grid, The exception "Column A does not belong to table X".&lt;/P&gt;&lt;P&gt;There must be an easy way to control and manage the extended properties and properties that are not used with current state of the object.&amp;nbsp;This&amp;nbsp;was the reason why&amp;nbsp;they&amp;nbsp;were not selected. Otherwise, All the properties and extended properties have to be selected in each query. It is not optimal when we have many relations (extended properties from other objects.) to do so.&lt;/P&gt;&lt;P&gt;Note : Extended properties are used to binding purposes.</description><pubDate>Fri, 16 May 2008 08:16:05 GMT</pubDate><dc:creator>Ertan Deniz</dc:creator></item><item><title>RE: Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost15240.aspx</link><description>The only way that you would get an error is if:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;The custom property is an actual field in the table that is expected when updating in which case you would want to add the field to the ExcludeOnUpdates property.&lt;/LI&gt;&lt;LI&gt;You are evaluating the field (referencing the field) when you have not pulled back the field that is used by the custom field&lt;/LI&gt;&lt;LI&gt;Calling the MyBo.Item property to retrieve the vaue from within that item which would cause a recursive error in which case you should be using MyBo.CurrentRow.Item("MyField")&lt;/LI&gt;&lt;/OL&gt;</description><pubDate>Sat, 29 Mar 2008 08:20:37 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Exception with Extended Properties</title><link>http://forum.strataframe.net/FindPost15239.aspx</link><description>What about the columns belong to the table, I 've written an sql to select some of the fields but I'm getting an argument exception : &lt;/P&gt;&lt;P&gt;Column 'code' does not belong to table mt_pch_companies.&lt;/P&gt;&lt;P&gt;Because I couldn't select this column. What is the way of managing column and object properties with these conditions ?</description><pubDate>Sat, 29 Mar 2008 00:52:55 GMT</pubDate><dc:creator>Ertan Deniz</dc:creator></item></channel></rss>