<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Xterface&#039;s Blog</title>
	<atom:link href="http://xterface.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://xterface.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Thu, 03 Dec 2009 16:56:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='xterface.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Xterface&#039;s Blog</title>
		<link>http://xterface.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://xterface.wordpress.com/osd.xml" title="Xterface&#039;s Blog" />
	<atom:link rel='hub' href='http://xterface.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Проблемы с сохранением формы ExtJS в Rails</title>
		<link>http://xterface.wordpress.com/2009/12/03/%d0%bf%d1%80%d0%be%d0%b1%d0%bb%d0%b5%d0%bc%d1%8b-%d1%81-%d1%81%d0%be%d1%85%d1%80%d0%b0%d0%bd%d0%b5%d0%bd%d0%b8%d0%b5%d0%bc-%d1%84%d0%be%d1%80%d0%bc%d1%8b-extjs-%d0%b2-rails/</link>
		<comments>http://xterface.wordpress.com/2009/12/03/%d0%bf%d1%80%d0%be%d0%b1%d0%bb%d0%b5%d0%bc%d1%8b-%d1%81-%d1%81%d0%be%d1%85%d1%80%d0%b0%d0%bd%d0%b5%d0%bd%d0%b8%d0%b5%d0%bc-%d1%84%d0%be%d1%80%d0%bc%d1%8b-extjs-%d0%b2-rails/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 16:56:53 +0000</pubDate>
		<dc:creator>xterface</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://xterface.wordpress.com/?p=30</guid>
		<description><![CDATA[Сегодня столкнулся с такой проблемой. При отправке формы на сервер происходило следующее:
Данные на сервер отправляются нормально, но ответ ExtJS "не понимает", не вызываются ни "success" ни "failure" функции. Только браузер спрашивает - "Чем файл открыть?".<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xterface.wordpress.com&amp;blog=9789242&amp;post=30&amp;subd=xterface&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Сегодня столкнулся с такой проблемой. При отправке формы на сервер происходило следующее:<br />
Данные на сервер отправляются нормально, но ответ ExtJS &#8220;не понимает&#8221;, не вызываются ни &#8220;success&#8221; ни &#8220;failure&#8221; функции. Только браузер спрашивает &#8211; &#8220;Чем файл открыть?&#8221;.</p>
<p>Код примерно следующий:</p>
<p><pre class="brush: jscript; gutter: false; highlight: [3];">
var form = new ExtJS.FormPanel({
  url: &quot;fileupload&quot;,
  fileUpload: true,
  items: [...],
  ...
});
</pre><br />
акция контроллера, которая обрабатывает запрос:</p>
<p><pre class="brush: ruby; gutter: false; highlight: [5,7];">
def fileupload
  fname = params[:filename]
  if File.exists? fname
    #...
    render :json=&gt;{:success=&gt;true, :message=&gt;&quot;Файл загружен успешно!&quot;}
  else
    render :json=&gt;{:success=&gt;false, :message=&gt;&quot;Файл не найден&quot;}
  end
end
</pre></p>
<p>Все это оказывается из-за того, что ExtJS не может отправить файл на сервер с помощью Ajax. Он создает скрытый iframe, отправляет данные формы стандартным способом и помещает результат в скрытый iframe. Но браузер почему-то не понимает возвращаемые ему данные в json формате и типом html/application <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .<br />
Решение проблемы напрашивается само сабой: заменить тип возвращаемого результата на текст.</p>
<p><pre class="brush: ruby; gutter: false;">
  render :text=&gt;{:success=&gt;false, :message=&gt;&quot;Файл не найден&quot;}.to_json
</pre></p>
<p>Все. Надеюсь кому-нибудь эта заметка помогла.<br />
Удачи!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xterface.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/xterface.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/xterface.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/xterface.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/xterface.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/xterface.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/xterface.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/xterface.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/xterface.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/xterface.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/xterface.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/xterface.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/xterface.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/xterface.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xterface.wordpress.com&amp;blog=9789242&amp;post=30&amp;subd=xterface&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://xterface.wordpress.com/2009/12/03/%d0%bf%d1%80%d0%be%d0%b1%d0%bb%d0%b5%d0%bc%d1%8b-%d1%81-%d1%81%d0%be%d1%85%d1%80%d0%b0%d0%bd%d0%b5%d0%bd%d0%b8%d0%b5%d0%bc-%d1%84%d0%be%d1%80%d0%bc%d1%8b-extjs-%d0%b2-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7939da2e94d9ab4579d400e0056b7e7e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">xterface</media:title>
		</media:content>
	</item>
		<item>
		<title>Generate read-only mapping to the DB2 database using C#</title>
		<link>http://xterface.wordpress.com/2009/10/06/generate-read-only-mapping-to-the-db2-database-using-c/</link>
		<comments>http://xterface.wordpress.com/2009/10/06/generate-read-only-mapping-to-the-db2-database-using-c/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 19:41:37 +0000</pubDate>
		<dc:creator>xterface</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Generator]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://xterface.wordpress.com/?p=3</guid>
		<description><![CDATA[I think we need a tool. This tool must generate all classes and using it must be simple. Like this:
[sourcecode language="shell"]
generator wp.company db2 "Database..." Staff "d:\work\gen1"
[/sourcecode]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xterface.wordpress.com&amp;blog=9789242&amp;post=3&amp;subd=xterface&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<blockquote><p>Maybe there a many better tools for object relational mapping, but i don&#8217;t care <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
It&#8217;s simple. And it&#8217;s worked for me.<br />
Ok, let&#8217;s start.
</p></blockquote>
<h1>What do we have?</h1>
<p>We have a database (IBM DB2 Express-C) with many tables. This post was written for DB2, but many other databases may be used if you write some code. I&#8217;ll explain how to make an adapter later.<br />
<pre class="brush: sql;">
CREATE TABLE WP.COMPANY (
  COMPANY_ID INTEGER  NOT NULL GENERATED ALWAYS AS IDENTITY,
  NAME VARCHAR (255) NOT NULL,
  CONSTRAINT PRIMARY KEY (COMPANY_ID),
  CONSTRAINT UNIQUE (NAME)
);

CREATE TABLE WP.TEAM (
  COMPANY_ID INTEGER  NOT NULL,
  TEAM_ID INTEGER  NOT NULL GENERATED ALWAYS AS IDENTITY,
  NAME VARCHAR (255) NOT NULL,
  CONSTRAINT PRIMARY KEY (COMPANY_ID, TEAM_ID),
  CONSTRAINT UNIQUE (COMPANY_ID, NAME),
  CONSTRAINT FOREIGN KEY (COMPANY_ID)
     REFERENCES WP.COMPANY ON DELETE RESTRICT
);

CREATE TABLE WP.PERSON (
  COMPANY_ID INTEGER  NOT NULL,
  TEAM_ID INTEGER  NOT NULL GENERATED ALWAYS AS IDENTITY,
  NAME VARCHAR (255) NOT NULL,
  CONSTRAINT PRIMARY KEY (COMPANY_ID, TEAM_ID),
  CONSTRAINT UNIQUE (COMPANY_ID, NAME),
  CONSTRAINT FOREIGN KEY (COMPANY_ID)
     REFERENCES WP.COMPANY ON DELETE RESTRICT
);
</pre></p>
<h1>What do we need?</h1>
<p>We have a tables named as <code>company</code>, <code>team</code> and <code>person</code>. And we need use them like that:<br />
<pre class="brush: csharp;">
    XDict dict = new XDict(&quot;Database=SAMPLE;User ID=test;password=secret;Server=localhost:50001&quot;);
    Company comp = dict.Companys.Single(c =&gt; c.Name == &quot;IBM&quot;);
    Teams[] transTeams = comp.Teams.Where(t =&gt;
        t.Persons.Contains(p =&gt;
            p.Name == &quot;Armin van Buuren&quot;));
    ...
</pre></p>
<h1>We need a tool!</h1>
<p>I think we need a tool. This tool must generate all classes and using it must be simple. Like this:<br />
<pre class="brush: bash;">
generator wp.company db2 &quot;Database...&quot; Staff &quot;d:\work\gen1&quot;
</pre><br />
Where:</p>
<ul>
<li>wp.company &#8211; the table name in database</li>
<li>db2 &#8211; type of database</li>
<li>&#8220;Database&#8230;&#8221; &#8211; connection string</li>
<li>Staff &#8211; Target namespace</li>
<li>&#8220;d:\work\gen1&#8243; &#8211; Output directory</li>
</ul>
<p>All done! </p>
<p>Stop! We have a three table! How about <code>team</code> and <code>person</code>?<br />
Simple: database must know about all relations. And tool must get this info and generate three files:<br />
Company.cs, Team.cs and Person.cs.</p>
<p>Ok, let&#8217;s make this generator!</p>
<h1>How?</h1>
<p>We write class <code>XClassGen</code> that use MetaReader for generate classes. It will connect to the database and will read structure of the database from system catalog tables.</p>
<h2>MetaReader</h2>
<p>First of all it is necessary to create an abstract class MetaReader.<br />
<pre class="brush: csharp;">
    public abstract class MetaReader
    {
        public MetaReader(string connectionString)
        {
            this.ConnectionString = connectionString;
            this.PropNameAliases = new Dictionary&lt;string, ReferenceNames&gt;();
        }
        ...
        protected abstract MetaTable ReadTable(string schemaName, string tableName);
        protected abstract MetaColumn[] ReadColumns(MetaTable table);
        protected abstract MetaProp[] ReadProps(MetaTable table);

        public Dictionary&lt;string, ReferenceNames&gt; PropNameAliases { get; private set; }
        ...
</pre></p>
<p>MetaTable class will be used for keeping ShemaName and TableName.<br />
<pre class="brush: csharp;">
    public class MetaTable
    {
        internal MetaTable(string schemaName, string tableName)
        {
            this.SchemaName = schemaName;
            this.TableName = tableName;
        }
        public string SchemaName { get; private set; }
        public string TableName { get; private set; }
    }
</pre></p>
<p>Sometimes the code may say about self better than writer <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<pre class="brush: csharp;">
    public class MetaColumn
    {
        internal MetaColumn(string name, string dbName, string columnType, bool nullable,
            short columnSeq, bool isPrimaryKey, short primaryKeySeq)
        {
        ...
        }

        public string Name { get; private set; }
        internal string DbName { get; private set; }
        public string ColumnType { get; private set; }
        public bool Nullable { get; private set; }
        public short ColumnSeq { get; private set; }
        public bool IsPrimaryKey { get; private set; }
        public short PrimaryKeySeq { get; private set; }
    }
</pre></p>
<p>MetaProp. In fact this class reflect a referential constraints.<br />
<pre class="brush: csharp;">
    public class MetaProp
    {
        internal MetaProp(string name, string[] selfColumns, ...) {...}

        public string Name { get; private set; }
        public MetaTable OtherTable { get; private set; }
        public string[] SelfColumns { get; private set; }
        public string[] OtherColumns { get; private set; }
        public bool IsCollection { get; private set; }
    }
</pre></p>
<h2>DB2MetaReader</h2>
<p>Now we are creating an adapter for IBM DB2 database.<br />
<pre class="brush: csharp;">
    public sealed class DB2MetaReader : MetaReader
    {
        public DB2MetaReader(string connectionString) : base(connectionString) { }

        protected override MetaTable ReadTable(string schemaName, string tableName)
        {
            string sql = string.Format(@&quot;
                select 
                    table_schem as schema_name, 
                    table_name as table_name, 
                    table_type as table_type
                from 
                    sysibm.sqltables 
                where 
                    table_type = 'TABLE' and
                    table_schem = '{0}' and
                    table_name = '{1}'&quot;, new object[] { schemaName, tableName });
            
            DataTable tbl = GetDataTable(sql);

            if (tbl.Rows.Count &lt; 1)
            {
                throw new Exception(&quot;Table '&quot; + schemaName + &quot;.&quot; + tableName + &quot;' not found.&quot;);
            }

            return new MetaTable(schemaName, tableName);
        }

        protected override MetaColumn[] ReadColumns(MetaTable table)
        {
            List&lt;MetaColumn&gt; columns = new List&lt;MetaColumn&gt;();
            string sql = string.Format(@&quot; 
                select
                    trim(c.colname) as field_name,
                    trim(coalesce(t.sourcename, c.typename)) as field_type,
                    c.colno as field_seq,
                    c.length as field_length,
                    trim(c.nulls) as has_nulls,
                    k.colseq as pk_seq
                from
                    syscat.columns c  
                        inner join syscat.datatypes t on  
                            t.typeschema = c.typeschema and  
                            t.typename = c.typename  
                        left outer join syscat.tabconst tc on
                            tc.tabschema = c.tabschema  and
                            tc.tabname = c.tabname and
                            tc.type = 'P'
                        left outer join syscat.keycoluse k on
                        	k.tabschema = tc.tabschema and
                        	k.tabname = tc.tabname and
                        	k.colname = c.colname and
                            k.constname = tc.constname 
                where 
                    c.tabschema = '{0}' and
                    c.tabname = '{1}'&quot;, new object[] { table.SchemaName, table.TableName });

            DataTable tbl = GetDataTable(sql);

            foreach (DataRow row in tbl.Rows)
            {
                bool nullable = (string)row[&quot;HAS_NULLS&quot;] == &quot;Y&quot;;
                bool isPrimaryKey = !(row[&quot;PK_SEQ&quot;] is DBNull);
                short pkSeq = -1;
                if (isPrimaryKey)
                {
                    pkSeq = (short)row[&quot;PK_SEQ&quot;];
                }
                columns.Add(new MetaColumn(
                    ((string)row[&quot;FIELD_NAME&quot;]).CheckThis(),
                    (string)row[&quot;FIELD_NAME&quot;],
                    GetTypeNameByDB2TypeName((string)row[&quot;FIELD_TYPE&quot;], nullable),
                    nullable, (short)row[&quot;FIELD_SEQ&quot;],
                    isPrimaryKey, pkSeq));
            }

            return columns.OrderBy(c=&gt;c.ColumnSeq).ToArray();
        }

        protected override MetaProp[] ReadProps(MetaTable table)
        {
        ...
        }
    ...
    }
</pre></p>
<h2>Generator</h2>
<p><pre class="brush: csharp;">
    public class XClassGen
    {
        public XClassGen(MetaReader reader, string tablesToGen, string removePrefix, string namespaceName, string saveToFolder)
        {
        ...
        }
        ...
        public void DoGen()
        {
            tables = new List&lt;MetaTable&gt;();
            string[] tableNames = TablesToGen.Split(';');
            foreach (string tName in tableNames)
            {
                string[] partName = tName.Split('.');
                if (partName.Length == 2)
                {
                    GenTable(Reader.GetTable(partName[0], partName[1]));
                }
                else
                {
                    throw new Exception(&quot;Wrong Table Name: &quot; + tName);
                }
            }
            GenDict();
            Console.WriteLine();
            Console.WriteLine(&quot;Done.&quot;);
        }

        private void StoreClass(string className, string content)
        {
            string fileName = SaveToFolder.TrimEnd('\') + &quot;\&quot; + className + &quot;.cs&quot;;
            using (StreamWriter sw = new StreamWriter(fileName))
            {
                sw.Write(content);
                sw.Flush();
                sw.Close();
            }
            Console.WriteLine(&quot;File '&quot; + fileName + &quot;' was saved.&quot;);
        }

        private void GenTable(MetaTable table)
        {
            if (tables.Contains(table))
            {
                return;
            }
            tables.Add(table);
            MetaColumn[] columns = Reader.GetColumns(table);
            MetaProp[] props = Reader.GetProps(table);

            string className = table.TableName.Beauty(RemovePrefix);

            string res = &quot;using System;\r\nusing System.Collections.Generic;\r\n&quot;;
            res += &quot;using System.Linq;\r\nusing System.Text;\r\n\r\nnamespace &quot; + NamespaceName + &quot;\r\n{\r\n&quot;;
            res += &quot;\tpublic class &quot; + className + &quot;\r\n\t{\r\n\t\tinternal &quot; + className + &quot;(XDict dict, &quot;;
            res += string.Join(&quot;, &quot;, columns.Select&lt;MetaColumn, string&gt;(c =&gt;
                c.ColumnType + &quot; &quot; + c.Name.Beauty().FirstCharLower()).ToArray()) + &quot;)\r\n\t\t{\r\n&quot;;
            res += &quot;\t\t\tthis.Dict = dict;\r\n\r\n&quot;;
            res += string.Join(&quot;&quot;, columns.Select&lt;MetaColumn, string&gt;(c =&gt;
                &quot;\t\t\tthis.&quot; + c.Name.Beauty() + &quot; = &quot; + c.Name.Beauty().FirstCharLower() + &quot;;\r\n&quot;).ToArray());

            string loadEvs = &quot;&quot;;
            string propsBlock = &quot;&quot;;

            foreach (MetaProp pr in props)
            {
                string prName = pr.Name.Beauty(RemovePrefix);
                string prFldName = prName.FirstCharLower();
                string prLoadFn = prFldName + &quot;_OnLoad&quot;;
                string prType = pr.OtherTable.TableName.Beauty(RemovePrefix) + (pr.IsCollection ? &quot;[]&quot; : &quot;&quot;);
                res += &quot;\r\n\t\t\tthis.&quot; + prFldName + &quot; = new XLazyLoad&lt;&quot; + prType + &quot;&gt;();\r\n&quot;;
                res += &quot;\t\t\tthis.&quot; + prFldName + &quot;.OnLoad += new LoadEventDelegate&lt;&quot; + prType + &quot;&gt;(&quot; + prLoadFn + &quot;);\r\n&quot;;

                loadEvs += &quot;\r\n\t\tvoid &quot; + prLoadFn + &quot;(out &quot; + prType + &quot; valueForLoad)\r\n\t\t{\r\n&quot;;
                loadEvs += &quot;\t\t\tvalueForLoad = Dict.&quot; + pr.OtherTable.TableName.Beauty(RemovePrefix) + &quot;s.Where(x =&gt; &quot;;
                List&lt;string&gt; pairs = new List&lt;string&gt;();
                for (int i = 0; i &lt; pr.SelfColumns.Length; i++)
                {
                    pairs.Add(&quot;(x.&quot; + pr.OtherColumns[i].Beauty() + &quot; == this.&quot; + pr.SelfColumns[i].Beauty() + &quot;)&quot;);
                }
                loadEvs += &quot;\r\n\t\t\t\t&quot; + string.Join(&quot; &amp;&amp; \r\n\t\t\t\t&quot;, pairs.ToArray()) + &quot;)&quot; +
                    (pr.IsCollection ? &quot;.ToArray()&quot; : &quot;.SingleOrDefault()&quot;) + &quot;;\r\n\t\t}\r\n&quot;;

                propsBlock += &quot;\r\n\t\tprivate XLazyLoad&lt;&quot; + prType + &quot;&gt; &quot; + prFldName +
                    &quot;;\r\n\t\tpublic &quot; + prType + &quot; &quot; + prName + &quot;{ get { return &quot; + prFldName + &quot;.Value; } }\r\n&quot;;
            }

            res += &quot;\t\t}\r\n\r\n&quot;;

            res += &quot;\t\tpublic XDict Dict { get; private set; }\r\n&quot;;

            res += loadEvs;

            res += &quot;\r\n\t\t&quot; + string.Join(&quot;\r\n\t\t&quot;, columns.Select&lt;MetaColumn, string&gt;(c =&gt;
                &quot;public &quot; + c.ColumnType + &quot; &quot; + c.Name.Beauty() + &quot; { get; private set; }&quot;).ToArray()) + &quot;\r\n&quot;;

            res += propsBlock;

            res += &quot;\r\n\t\tpublic string ID\r\n\t\t{\r\n\t\t\tget\r\n\t\t\t{\r\n\t\t\t\treturn &quot;;
            res += string.Join(&quot; + \&quot;.\&quot; + &quot;, columns
                .Where(c =&gt; c.IsPrimaryKey)
                .OrderBy(oc =&gt; oc.PrimaryKeySeq)
                .Select&lt;MetaColumn, string&gt;(mc =&gt; &quot;this.&quot; + mc.Name.Beauty() + &quot;.ToString()&quot;)
                .ToArray());
            res += &quot;;\r\n\t\t\t}\r\n\t\t}\r\n&quot;;
            
            res += &quot;\r\n\t\tpublic override string ToString()\r\n\t\t{\r\n\t\t\treturn ID;\r\n\t\t}\r\n&quot;;

            res += &quot;\t}\r\n}&quot;;

            StoreClass(className, res);

            foreach (MetaProp pr in props)
            {
                GenTable(pr.OtherTable);
            }
        }
        
        private void GenDict()
        {
            ...
            StoreClass(&quot;XDict&quot;, res);
        }
    }
}
</pre></p>
<p>Private method <code>GenDict()</code> will generate one more class called <code>XDict</code>to the output directory. This class will read the data from database and create objects and collections for <code>Company</code>, <code>Team</code> and <code>Person</code> classes.</p>
<p>Full source code I can upload on sourceforge. If anybody needs that.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/xterface.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/xterface.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/xterface.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/xterface.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/xterface.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/xterface.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/xterface.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/xterface.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/xterface.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/xterface.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/xterface.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/xterface.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/xterface.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/xterface.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=xterface.wordpress.com&amp;blog=9789242&amp;post=3&amp;subd=xterface&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://xterface.wordpress.com/2009/10/06/generate-read-only-mapping-to-the-db2-database-using-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7939da2e94d9ab4579d400e0056b7e7e?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">xterface</media:title>
		</media:content>
	</item>
	</channel>
</rss>
