<?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/"
	>

<channel>
	<title>Erp Objects</title>
	<atom:link href="http://erp.objects.neurospeech.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://erp.objects.neurospeech.com/blog</link>
	<description>Powerful ORML Tool by NeuroSpeech</description>
	<lastBuildDate>Mon, 24 Aug 2009 12:16:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adapter Class</title>
		<link>http://erp.objects.neurospeech.com/blog/?p=83</link>
		<comments>http://erp.objects.neurospeech.com/blog/?p=83#comments</comments>
		<pubDate>Mon, 08 Dec 2008 16:32:10 +0000</pubDate>
		<dc:creator>Akash</dc:creator>
				<category><![CDATA[Documentation]]></category>

		<guid isPermaLink="false">http://erp.objects.neurospeech.com/blog/?p=83</guid>
		<description><![CDATA[Ok, here comes most important part, that is explanation of &#8220;Adapter&#8221; class, which actually executes queries and following section enlists all possible ways.
The most important part, as &#38;&#38; and &#124;&#124; operators are not overridable, the SQL AND is replaced by single &#8220;&#38;&#8221; operand and OR is replaced by single &#8220;&#124;&#8221; operand in order to build [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, here comes most important part, that is explanation of &#8220;Adapter&#8221; class, which actually executes queries and following section enlists all possible ways.</p>
<blockquote><p><span style="color: #008080;">The most important part, as &amp;&amp; and || operators are not overridable, the SQL AND is replaced by single &#8220;&amp;&#8221; operand and OR is replaced by single &#8220;|&#8221; operand in order to build the query expression</span></p></blockquote>
<p>Throught this section, we will use following schema,</p>
<p><strong>Table: Customers</strong></p>
<p>Fields: CustomerID, FirstName, LastName, IsActive</p>
<p><strong><strong>Table: Invoices</strong></strong></p>
<p>Fields: InvoiceID, InvoiceDate, Amount, CustomerID</p>
<p>and now note that, CustomerID of Invoices table refers to CustomerID of  Customers.</p>
<h2><strong>Query Single Object</strong></h2>
<pre><span style="color: #008080;">Invoice</span>.Adapter.Get( 2312 );</pre>
<p>Just by specifying the &#8220;Long&#8221; ID.</p>
<h2><strong>Query Single Object by &#8220;WHERE&#8221;</strong></h2>
<pre><span style="color: #008080;">Invoice</span>.Adapter.Get( <span style="color: #008080;">Invoice</span>.Schema.InvoiceID == 2312 );</pre>
<p>This is an expression tree, and it is built by schema access.</p>
<pre><span style="color: #008080;">Invoice</span>.Adapter.Get(
   <span style="color: #008080;">Customer</span>.Schema.IsActive == <span style="color: #0000ff;">true </span>,
   <span style="color: #008080;">Customer</span>.Schema.CustomerID.SortDesc());</pre>
<p>This expression creates an Auto Join and also sorts CustomerID in descending order, giving you the invoice of last added customer</p>
<h2><strong>Compound WHERE Expression by &#8220;AND&#8221;<br />
</strong></h2>
<pre><span style="color: #008080;">Invoice</span>.Adapter.GetAll(
   <span style="color: #008080;">Invoice</span>.Schema.InvoiceDate &gt;= new <span style="color: #008080;">DateTime</span>(2001,1,1) &amp;
   <span style="color: #008080;">Invoice</span>.Schema.Status != "<span style="color: #ff0000;">PAID</span>");</pre>
<p>This compond expression contains two expressions and &#8220;AND&#8221; operator.</p>
<h2>Dynamic Expression Tree for WHERE</h2>
<p>Consider following sample of searching customer,</p>
<pre><span style="color: #0000ff;">private </span><span style="color: #008080;">CustomerList </span>Search(<span style="color: #0000ff;">string </span>name, <span style="color: #0000ff;">string </span>email, <span style="color: #0000ff;">string </span>phone,
    <span style="color: #0000ff;">int </span>start, <span style="color: #0000ff;">int </span>size)
{
    <span style="color: #008080;">ErpExpression </span>exp = <span style="color: #0000ff;">null</span>;
    if(!<span style="color: #008080;">String</span>.IsNullOrEmpty(name))
        exp &amp;= <span style="color: #008080;">Customer</span>.Schema.FirstName.Contains(name);
    if(!<span style="color: #008080;">String</span>.IsNullOrEmpty(email))
        exp &amp;= <span style="color: #008080;">Customer</span>.Schema.EmailAddress.Contains(email);
    if(!<span style="color: #008080;">String</span>.IsNullOrEmpty(phone))
        exp &amp;= <span style="color: #008080;">Customer</span>.Schema.Phone.Contains(phone);

<span style="color: #008000;">    // note this exp Expression is dynamic depending upon
    // values specified at run time</span>
    <span style="color: #0000ff;">return </span><span style="color: #008080;">Customer</span>.Adapter.GetAll(exp, start, size);
}</pre>
<p>The above function returns all Customers if all parameters are either null or empty. This search functionality is very essential in order to build dynamic query expression, which is not offered in any of the ORML software existing till date.</p>
<p>You can sure use &amp; or | respectively for AND or OR operators, however please try to visualize the expression tree in order to avoid any confusion.</p>
]]></content:encoded>
			<wfw:commentRss>http://erp.objects.neurospeech.com/blog/?feed=rss2&amp;p=83</wfw:commentRss>
		<slash:comments>428</slash:comments>
		</item>
		<item>
		<title>Specifying Relations and Handling Joins</title>
		<link>http://erp.objects.neurospeech.com/blog/?p=74</link>
		<comments>http://erp.objects.neurospeech.com/blog/?p=74#comments</comments>
		<pubDate>Mon, 08 Dec 2008 15:55:56 +0000</pubDate>
		<dc:creator>Akash</dc:creator>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Detail]]></category>
		<category><![CDATA[Joins]]></category>
		<category><![CDATA[Master]]></category>
		<category><![CDATA[Relations]]></category>

		<guid isPermaLink="false">http://erp.objects.neurospeech.com/blog/?p=74</guid>
		<description><![CDATA[Well here comes the most intricate parts of joins handling, most of the time we require queries to be able to pull different data from different tables.
This section could be little lengthy, but its worth spending time on.
Lets assume following case.
Table: Customers
Fields: CustomerID, FirstName, LastName, IsActive
Table: Invoices
Fields: InvoiceID, InvoiceDate, Amount, CustomerID
and now note that, CustomerID [...]]]></description>
			<content:encoded><![CDATA[<p>Well here comes the most intricate parts of joins handling, most of the time we require queries to be able to pull different data from different tables.</p>
<p>This section could be little lengthy, but its worth spending time on.</p>
<p>Lets assume following case.</p>
<p><strong>Table: Customers</strong></p>
<p>Fields: CustomerID, FirstName, LastName, IsActive</p>
<p><strong>Table: Invoices</strong></p>
<p>Fields: InvoiceID, InvoiceDate, Amount, CustomerID</p>
<p>and now note that, CustomerID of Invoices table refers to CustomerID of Customers.</p>
<h3><strong>Specify Relations</strong></h3>
<p>In Erp Objects Editor, when you click on item &#8220;CustomerID&#8221; in the &#8220;Invoice&#8221; object in the tree view of left side.<a href="http://erp.objects.neurospeech.com/blog/wp-content/uploads/2008/12/relatedproperty.png"><img class="aligncenter size-full wp-image-73" title="Related Property" src="http://erp.objects.neurospeech.com/blog/wp-content/uploads/2008/12/relatedproperty.png" alt="" width="496" height="409" /></a></p>
<p>As specified above, you can see, we specify Related Object and Related Object Property. Related Object Property is essentially Primary Key of the related object. And we also specify &#8220;CreateRelatedObjectProperty&#8221; true. Which encapsulates related Customer object and you can access values as specified below.</p>
<pre><span style="color: #008080;">Invoice</span> inv = <span style="color: #008080;">Invoice</span>.Adapter.Get(12212);
<span style="color: #008080;">Console</span>.WriteLine(inv.Customer.FirstName);</pre>
<p>Please note, the Customer property is cached in invoice object, and if its related customer object has been deleted in the database, it still returns an Empty Customer object, in order to avoid null exception errors.</p>
<h3>Related Object&#8217;s Children</h3>
<p>If you specify &#8220;<strong>CreatePropertyInRelatedObject</strong>&#8221; to be true and relation type to be Children, then it creates &#8220;InvoiceList&#8221; property in Customer class. So that you can get master detail relations.</p>
<pre><span style="color: #008080;">Customer</span> c = <span style="color: #008080;">Customer</span>.Adapter.Get(121212);
<span style="color: #0000ff;">foreach</span>(<span style="color: #008080;">Invoice </span>inv in c.InvoiceList)
{
    <span style="color: #008080;">Console</span>.WriteLine(inv.Amount);
}</pre>
<h3>Auto Join</h3>
<p>Once you have established the relations specified above, Erp Objects prepares a default &#8220;Join Dictionary&#8221;. Which enables you to query related object properties without specifying joins. For example,</p>
<pre><span style="color: #008080;">InvoiceList</span> invoices =
    <span style="color: #008080;">Invoice</span>.Adapter.GetAll(
         <span style="color: #008080;">Customer</span>.Schema.IsActive == <span style="color: #0000ff;">true </span>);</pre>
<p>Note above query carefully, as Customer and Invoice are related, a default join of type &#8220;<strong>LEFT JOIN CUSTOMER ON CUSTOMERS.CUSTOMERID=INVOICES.CUSTOMERID</strong>&#8221; is automatically added in the SQL. Erp Objects is smart enough to determine the shortest path for the Joins. <em>And for this the code generation takes little longer time for bigger databases and for bigger relations</em>.</p>
<h3>Explicit Join</h3>
<p>You can specify explicit join also, and in this case, the Auto Join is completely ignored. Following is the syntax.</p>
<pre><span style="color: #008080;">InvoiceList</span> invoices =
    <span style="color: #008080;">Invoice</span>.Adapter.GetAll( <span style="color: #008080;">Customer</span>.Schema.IsActive == <span style="color: #0000ff;">true</span>,
        <span style="color: #008080;">Sql</span>.LeftJoin("<span style="color: #ff0000;">Customer</span>",
             <span style="color: #008080;">Customer</span>.Schema.CustomerID == <span style="color: #008080;">Invoice</span>.Schema.CustomerID <span style="color: #0000ff;"></span>));</pre>
<p>The second parameter could be any valid Erp Expression.</p>
]]></content:encoded>
			<wfw:commentRss>http://erp.objects.neurospeech.com/blog/?feed=rss2&amp;p=74</wfw:commentRss>
		<slash:comments>30</slash:comments>
		</item>
		<item>
		<title>Code Generation</title>
		<link>http://erp.objects.neurospeech.com/blog/?p=62</link>
		<comments>http://erp.objects.neurospeech.com/blog/?p=62#comments</comments>
		<pubDate>Mon, 08 Dec 2008 15:17:05 +0000</pubDate>
		<dc:creator>Akash</dc:creator>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Code Generation]]></category>
		<category><![CDATA[CodeGen]]></category>

		<guid isPermaLink="false">http://erp.objects.neurospeech.com/blog/?p=62</guid>
		<description><![CDATA[The core of Erp Objects only provides simple SQL connectivity, but the code is not usable in any form unless you generate the code based on your target database.
There are some conventions we maintain and we would like you to maintain these as well. In your application project, please create folder called &#8220;Data&#8221; and create [...]]]></description>
			<content:encoded><![CDATA[<p>The core of Erp Objects only provides simple SQL connectivity, but the code is not usable in any form unless you generate the code based on your target database.</p>
<p>There are some conventions we maintain and we would like you to maintain these as well. In your application project, please create folder called &#8220;Data&#8221; and create a text file called &#8220;Data.erd&#8221;, as soon as you create &#8220;Data.erd&#8221; file, the Erp Objects Editor will open automatically.</p>
<p>Well please note the application is kind of still under development, the menus etc, dont expect it to work anything other then specified below.</p>
<p>For all methods specified below, please use following,</p>
<h3><strong>Specify Connection</strong></h3>
<p>Please specify &#8220;ConnectionString&#8221; and &#8220;DatabaseType&#8221; to connect to your database.</p>
<h3><strong>Generating Simple Code</strong></h3>
<ol>
<li>Once you specify the connection details, click on &#8220;Refresh&#8221;.</li>
<li>This will populate, Table and its corresponding fields on the left side in tree view.</li>
<li>Now you can click on &#8220;Generate Code&#8221; button which will create &#8220;Data.erd.cs&#8221; file.</li>
<li>Please note you must import this &#8220;Data.erd.cs&#8221; using &#8220;Add Existing Item&#8221; menu in your C# project.</li>
</ol>
<h3><strong>Generate Updatable Code</strong></h3>
<p>Often you require to store a timestamp value in your table to store when it was last updated. However please note, by clicking the button &#8220;Refresh Updatable&#8221;, you can create auto updatable code for all the table which defines &#8220;LastUpdate&#8221; Column name with type &#8220;DateTime&#8221;.</p>
<p>For all the tables, that contain column &#8220;LastUpdate&#8221;, the generated code automatically inserts, modifies LastUpdate whenever you modify them and its done automatically.</p>
<p>For example, table &#8220;Products&#8221; does not have LastUpdate column but table &#8220;Invoices&#8221; has LastUpdate column.</p>
<pre><span style="color: #008080;">Product </span>p = <span style="color: #008080;">Product</span>.Adapter.Get(1211);
p.Price = 2.1;
p.Update(); <span style="color: #008000;">//&lt;-- no timestamp update...</span>

<span style="color: #008080;">Invoice </span>inv = <span style="color: #008080;">Invoice</span>.Adapter.Get(121122);
inv.Amount = 2.1;
inv.Update(); <span style="color: #008000;">// &lt;-- column LastUpdate is automatically set.

</span></pre>
<p><span style="color: #000000;">It is manditory for now that the column name must be &#8220;LastUpdate&#8221; only.</span></p>
<h3>Generate Slave Code</h3>
<p>This button ignores &#8220;LastUpdate&#8221; and by default inserts &#8220;Auto Number Values&#8221; in &#8220;Insert&#8221; method as well, this provides facility to reinsert auto number values correctly in &#8220;Slave&#8221; databases.</p>
]]></content:encoded>
			<wfw:commentRss>http://erp.objects.neurospeech.com/blog/?feed=rss2&amp;p=62</wfw:commentRss>
		<slash:comments>108</slash:comments>
		</item>
		<item>
		<title>PreRequisits</title>
		<link>http://erp.objects.neurospeech.com/blog/?p=55</link>
		<comments>http://erp.objects.neurospeech.com/blog/?p=55#comments</comments>
		<pubDate>Mon, 08 Dec 2008 14:53:43 +0000</pubDate>
		<dc:creator>Akash</dc:creator>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[ID]]></category>
		<category><![CDATA[Primary Key]]></category>

		<guid isPermaLink="false">http://erp.objects.neurospeech.com/blog/?p=55</guid>
		<description><![CDATA[You can use Erp Objects only when the following conditions are met. 
C# Target Language:
Your project&#8217;s target language should be C# only and it should support C# 2.0 onwards syntax.
Must have Primary Key:
Every table, or only the tables you access through Erp Objects, must have a &#8220;Primary Key&#8221; as a single column. Note that you [...]]]></description>
			<content:encoded><![CDATA[<p>You can use Erp Objects only when the following conditions are met. <strong></strong></p>
<p><strong>C# Target Language:</strong><br />
Your project&#8217;s target language should be C# only and it should support C# 2.0 onwards syntax.</p>
<p><strong>Must have Primary Key:<br />
</strong>Every table, or only the tables you access through Erp Objects, must have a &#8220;Primary Key&#8221; as a single column. Note that you can have some other Unique Index Constraint defined for multi column primary key values, but Erp Objects require every object to be able to be accessed via only one primary key.</p>
<p><strong>LONG AutoNumber Only:</strong><br />
Auto Number Primary Key can only be of type &#8220;LONG&#8221;, for example, BIGINT in MySQL and in MS SQL. Integer is not accepted. <strong></strong></p>
<p><strong>Only One Primary Key:<br />
</strong>If you have any relation table between two other tables and have two columns that constitute primary key then you should define a new &#8220;ID&#8221; to be Primary Key and Auto Number and specify a unique index over other two columns.</p>
<p><strong>No Column with name &#8220;ID&#8221;:<br />
</strong>There can not be any column name &#8220;ID&#8221;, since ID is defined in Erp Objects, you can not specify any column name in table as &#8220;ID&#8221;, you should always prefix it as &#8220;ProductID&#8221;, &#8220;CustomerID&#8221; etc etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://erp.objects.neurospeech.com/blog/?feed=rss2&amp;p=55</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Transaction Support</title>
		<link>http://erp.objects.neurospeech.com/blog/?p=51</link>
		<comments>http://erp.objects.neurospeech.com/blog/?p=51#comments</comments>
		<pubDate>Mon, 08 Dec 2008 14:33:11 +0000</pubDate>
		<dc:creator>Akash</dc:creator>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Transaction]]></category>

		<guid isPermaLink="false">http://erp.objects.neurospeech.com/blog/?p=51</guid>
		<description><![CDATA[Transactions are important parts of modern Business Application and every RDBMS provides inbuilt support for transactions.
In Erp Objects, the transactions are very simple and you do not have to specify anything to initialize, create, commit or rollback. Please observe following code very carefully.
public void TransferFunds(long fromAccountID, long toAccountID, decimal amount)
{
     ErpContext.ExecuteTransaction(
          delegate()
          {
     [...]]]></description>
			<content:encoded><![CDATA[<p>Transactions are important parts of modern Business Application and every RDBMS provides inbuilt support for transactions.</p>
<p>In Erp Objects, the transactions are very simple and you do not have to specify anything to initialize, create, commit or rollback. Please observe following code very carefully.</p>
<pre><span style="color: #0000ff;">public void </span>TransferFunds(<span style="color: #0000ff;">long </span>fromAccountID, <span style="color: #0000ff;">long </span>toAccountID, <span style="color: #0000ff;">decimal </span>amount)
{
     <span style="color: #008080;">ErpContext</span>.ExecuteTransaction(
          <span style="color: #0000ff;">delegate</span>()
          {
               <span style="color: #008080;">BankAccount </span>fromAct =
                    <span style="color: #008080;">BankAccount</span>.Adapter.Get(fromAccountID);
               <span style="color: #008080;">BankAccount </span>toAct =
                    <span style="color: #008080;">BankAccount</span>.Adapter.Get(toAccountID);
               <span style="color: #0000ff;">if</span>(fromAct.Amount &lt; amount)
                    <span style="color: #0000ff;">throw new </span>Exception("<span style="color: #ff0000;">Insufficient funds.</span>");
<span style="color: #008000;">                    // above exception automatically rollbacks
                    // the current transaction
</span>               fromAct.Amount -= amount;
               fromAct.Update();
               toAct.Amount += amount;
               toAct.Update();
<span style="color: #008000;">               // successful processing commits the transaction
</span>          }
     );
}</pre>
<p>The logic here is pretty simple, all you need to do is, just execute all methods inside a delegate passed through &#8220;ErpContext.ExecuteTransaction&#8221;, however you practically never access any transaction at all, but dont worry, it works correctly. Any part of code inside delegate from anywhere raises any exception, then the transaction is automatically rollbacked. If you want to rollback the transaction then you can simply throw any exception, however your thrown exception will also be thrown further in the stack so that your top most exception catcher can get this exception. But dont worry, the transaction is rollbacked too.</p>
<p>Successful execution of the statements inside delegate automatically commits the transaction at the end of it.</p>
<p>Other overload of Execute Transaction method provides some parameters which can be used to isolate the transaction accordingly however that has nothing to do with Erp Objects, as it is entirely and independently passed through the underlying database provider.</p>
]]></content:encoded>
			<wfw:commentRss>http://erp.objects.neurospeech.com/blog/?feed=rss2&amp;p=51</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Database Connectivity</title>
		<link>http://erp.objects.neurospeech.com/blog/?p=40</link>
		<comments>http://erp.objects.neurospeech.com/blog/?p=40#comments</comments>
		<pubDate>Mon, 08 Dec 2008 14:11:04 +0000</pubDate>
		<dc:creator>Akash</dc:creator>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Connectivity]]></category>
		<category><![CDATA[MS SQL]]></category>

		<guid isPermaLink="false">http://erp.objects.neurospeech.com/blog/?p=40</guid>
		<description><![CDATA[Currently Erp Objects offers database connectivity for following database servers.

MS SQL SERVER 2005 onwards (default)
MySQL 3.23 onwards

If you do not specify any provider type to be used in your code, MS SQL will be used as default.
However you can change the provider at runtime as well. Consider following cases.
Initializing app.config or web.config
You can initialize connectivity [...]]]></description>
			<content:encoded><![CDATA[<p>Currently Erp Objects offers database connectivity for following database servers.</p>
<ol>
<li>MS SQL SERVER 2005 onwards (default)</li>
<li>MySQL 3.23 onwards</li>
</ol>
<p>If you do not specify any provider type to be used in your code, MS SQL will be used as default.</p>
<p>However you can change the provider at runtime as well. Consider following cases.</p>
<h2>Initializing app.config or web.config</h2>
<p>You can initialize connectivity by specifying following lines in your app.config or web.config files respectively for your projects.</p>
<pre>&lt;<span style="color: #993366;">appSettings</span>&gt;
&lt;<span style="color: #993366;">add</span> <span style="color: #0000ff;">key</span>="<span style="color: #ff0000;">Erp.Objects.CodeDOM.Class</span>" <span style="color: #0000ff;">
value</span>="<span style="color: #ff0000;">Erp.Objects.CodeDOM.SqlCodeDOMProvider</span>"/&gt;
&lt;/<span style="color: #993366;">appSettings</span>&gt;

&lt;<span style="color: #993366;">connectionStrings</span>&gt;
&lt;<span style="color: #993366;">add</span> <span style="color: #0000ff;">name</span>="<span style="color: #ff0000;">ApplicationConnectionString</span>" <span style="color: #0000ff;">
c</span><span style="color: #0000ff;">onnectionString</span>="<span style="color: #ff0000;">.. fill your values..</span>"/&gt;
&lt;/<span style="color: #993366;">connectionStrings</span>&gt;</pre>
<p>Default name of ConnectionString is reserved to be &#8220;ApplicationConnectionString&#8221;, because it is assumed that most of the time you will be connecting to only one database throught your application life time. At run time you can still define different connection and you will learn it below.</p>
<p>Please note, there are two values for key &#8220;<span style="color: #ff0000;">Erp.Objects.CodeDOM.Class</span>&#8220;,</p>
<ol>
<li>
<pre><span style="color: #ff0000;">"Erp.Objects.CodeDOM.SqlCodeDOMProvider"<span style="color: #000000;">, connects to MS SQL Database</span></span></pre>
</li>
<li>
<pre><span style="color: #ff0000;">"Erp.Objects.CodeDOM.MySqlCodeDOMProvider"<span style="color: #000000;">, connects to MySQL Database</span></span></pre>
</li>
</ol>
<p>It is important that you must provide this value correctly, otherwise if you assume just specifying mysql database connection string, it will not connect correctly.</p>
<h2>Initialization in Application or Global.asax init methods</h2>
<p>In your WinForm or XAML application, at some point just after the Main method gets called, or in Global.asax in case of Web Application, you can use following code to initialize Provider.</p>
<p>For MS SQL Database,</p>
<pre><span style="color: #0000ff;">Using </span><span style="color: #ff0000;"><span style="color: #008080;">Erp.Objects.CodeDOM</span>;</span></pre>
<pre><span style="color: #008080;">SqlCodeDOMProvider</span>.Provider =
   <span style="color: #0000ff;">new </span><span style="color: #008080;">SqlCodeDOMProvider</span>("<span style="color: #ff0000;">connectionString</span>");</pre>
<p>For MySQL Database,</p>
<pre><span style="color: #0000ff;">Using </span><span style="color: #ff0000;"><span style="color: #008080;">Erp.Objects.CodeDOM</span>;</span></pre>
<pre><span style="color: #008080;">SqlCodeDOMProvider</span>.Provider =
   <span style="color: #0000ff;">new </span><span style="color: #008080;">MySqlCodeDOMProvider</span>("<span style="color: #ff0000;">connectionString</span>");</pre>
<p>Please note, SqlCodeDOMProvider.Provider &lt;&#8211; is the static provider used all accorss your code. MySqlCodeDOMProvider is derived from SqlCodeDOMProvider and it just provides some syntactical differences.</p>
<p>Please note, this method should only be used first time, from next time, if you want to use the different connection just for small amount of time, you must use next method.</p>
<h2>Execute Remote Connection</h2>
<p>Well I didnt get any great name of this topic so I just left it to be &#8220;Execute Remote Connection&#8221; which means that the provider you specified in the methods above, the static one, &#8220;SqlCodeDOMProvider.Provider&#8221; is the provider used for your entire application and it is assumed to be the local provider for your entire application. But assume you might want to connect to some different database (it is thats why assumed to be &#8220;Remote database&#8221;, although it may be anywhere, but just for convention we will call it &#8220;Remote&#8221;). Then following is the method to do it.</p>
<pre><span style="color: #0000ff;">private void </span>ProcessRemoteStatements()
{

<span style="color: #008000;">     // Note that, the SqlCodeDOMProvider.Provider
     // is used for following code</span>

     <span style="color: #008080;">Product </span>pl = <span style="color: #0000ff;">new </span><span style="color: #008080;">Product</span>();
     pl.ProductName = "<span style="color: #ff0000;">plocal</span>";
     pl.Price = 1.2;
     pl.Insert();

     <span style="color: #008080;">SqlCodeDOMProvider </span>remoteProvider =
          <span style="color: #0000ff;">new </span><span style="color: #008080;">SqlCodeDOMProvider</span>( "<span style="color: #ff0000;">some remote db</span>" );
     <span style="color: #008080;">ErpContext</span>.ExecuteRemoteConnection(
          remoteProvider,
          <span style="color: #0000ff;">delegate</span>()
          {
<span style="color: #008000;">               // new provider is used between these braces only
</span>               <span style="color: #008080;">Product </span>p = <span style="color: #0000ff;">new </span><span style="color: #008080;">Product</span>();
               p.ProductName = "<span style="color: #ff0000;">P1</span>";
               p.Price = <span style="color: #800000;">2.3</span>;
               p.Insert();

          }
     );

<span style="color: #008000;">     // from now onwards, the default provider is used...
</span>}</pre>
<p>As you can use any number of statements inside the delegate for &#8220;ExecuteRemoteConnection&#8221; method, all the database related calls will be routed through the specified provider only.</p>
]]></content:encoded>
			<wfw:commentRss>http://erp.objects.neurospeech.com/blog/?feed=rss2&amp;p=40</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Erp Objects Setup 3.84</title>
		<link>http://erp.objects.neurospeech.com/blog/?p=35</link>
		<comments>http://erp.objects.neurospeech.com/blog/?p=35#comments</comments>
		<pubDate>Mon, 08 Dec 2008 13:50:41 +0000</pubDate>
		<dc:creator>Akash</dc:creator>
				<category><![CDATA[Download]]></category>

		<guid isPermaLink="false">http://erp.objects.neurospeech.com/blog/?p=35</guid>
		<description><![CDATA[Click Here to Download Erp.Objects.Setup.3.84
Size: 845KB
Requirements: Microsoft .Net 2.0
]]></description>
			<content:encoded><![CDATA[<p><strong><a href="http://erp.objects.neurospeech.com/blog/wp-content/uploads/2008/12/Erp.Objects.Setup.3.84.zip">Click Here to Download Erp.Objects.Setup.3.84</a></strong></p>
<p>Size: 845KB</p>
<p>Requirements: Microsoft .Net 2.0</p>
]]></content:encoded>
			<wfw:commentRss>http://erp.objects.neurospeech.com/blog/?feed=rss2&amp;p=35</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Installation</title>
		<link>http://erp.objects.neurospeech.com/blog/?p=25</link>
		<comments>http://erp.objects.neurospeech.com/blog/?p=25#comments</comments>
		<pubDate>Mon, 08 Dec 2008 13:37:32 +0000</pubDate>
		<dc:creator>Akash</dc:creator>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[Editor]]></category>
		<category><![CDATA[Installation]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[NeuroMySQL]]></category>

		<guid isPermaLink="false">http://erp.objects.neurospeech.com/blog/?p=25</guid>
		<description><![CDATA[Installation of Erp Objects is fairly simple, just run the installer and it binds &#8220;.erd&#8221; files to Erp Objects Editor. And &#8220;C:\Program Files\NeuroSpeech Technologies\Erp Objects\&#8221; here in this folder, you will find two important files.

Erp.Objects.Dll
NeuroMySql.Data.dll

The NeuroMySql.Data.dll is replacement for MySql.Data.dll due to an annoying bug that when Date Time is defined null, MySql throws exception [...]]]></description>
			<content:encoded><![CDATA[<p>Installation of Erp Objects is fairly simple, just run the installer and it binds &#8220;.erd&#8221; files to Erp Objects Editor. And &#8220;C:\Program Files\NeuroSpeech Technologies\Erp Objects\&#8221; here in this folder, you will find two important files.</p>
<ol>
<li>Erp.Objects.Dll</li>
<li>NeuroMySql.Data.dll</li>
</ol>
<p>The NeuroMySql.Data.dll is replacement for MySql.Data.dll due to an annoying bug that when Date Time is defined null, MySql throws exception instead of returning DateTime.MinVal.</p>
]]></content:encoded>
			<wfw:commentRss>http://erp.objects.neurospeech.com/blog/?feed=rss2&amp;p=25</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>
