Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 71d40963b505df4524269198e237b3e3 > files > 781

virtuoso-opensource-doc-6.1.4-2.fc14.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 <head profile="http://internetalchemy.org/2003/02/profile">
  <link rel="foaf" type="application/rdf+xml" title="FOAF" href="http://www.openlinksw.com/dataspace/uda/about.rdf" />
  <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />
  <meta name="dc.title" content="2. Installation Guide" />
  <meta name="dc.subject" content="2. Installation Guide" />
  <meta name="dc.creator" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="dc.copyright" content="OpenLink Software, 1999 - 2009" />
  <link rel="top" href="index.html" title="OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="search" href="/doc/adv_search.vspx" title="Search OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="parent" href="installation.html" title="Chapter Contents" />
  <link rel="prev" href="installnetriadd.html" title="Creating A Simple .NET RIA Services Application To Display Data&#10;From Virtuoso" />
  <link rel="next" href="clusterstcnf.html" title="Cluster Installation and Config" />
  <link rel="shortcut icon" href="../images/misc/favicon.ico" type="image/x-icon" />
  <link rel="stylesheet" type="text/css" href="doc.css" />
  <link rel="stylesheet" type="text/css" href="/doc/translation.css" />
  <title>2. Installation Guide</title>
  <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
  <meta name="author" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="copyright" content="OpenLink Software, 1999 - 2009" />
  <meta name="keywords" content="" />
  <meta name="GENERATOR" content="OpenLink XSLT Team" />
 </head>
 <body>
  <div id="header">
    <a name="installnetriavd" />
    <img src="../images/misc/logo.jpg" alt="" />
    <h1>2. Installation Guide</h1>
  </div>
  <div id="navbartop">
   <div>
      <a class="link" href="installation.html">Chapter Contents</a> | <a class="link" href="installnetriadd.html" title="Creating A Simple .NET RIA Services Application To Display Data&#10;From Virtuoso">Prev</a> | <a class="link" href="clusterstcnf.html" title="Cluster Installation and Config">Next</a>
   </div>
  </div>
  <div id="currenttoc">
   <form method="post" action="/doc/adv_search.vspx">
    <div class="search">Keyword Search: <br />
        <input type="text" name="q" /> <input type="submit" name="go" value="Go" />
    </div>
   </form>
   <div>
      <a href="http://www.openlinksw.com/">www.openlinksw.com</a>
   </div>
   <div>
      <a href="http://docs.openlinksw.com/">docs.openlinksw.com</a>
   </div>
    <br />
   <div>
      <a href="index.html">Book Home</a>
   </div>
    <br />
   <div>
      <a href="contents.html">Contents</a>
   </div>
   <div>
      <a href="preface.html">Preface</a>
   </div>
    <br />
   <div class="selected">
      <a href="installation.html">Installation Guide</a>
   </div>
    <br />
   <div>
      <a href="installwin32.html">Virtuoso for Windows</a>
   </div>
   <div>
      <a href="linuxinstall.html">Virtuoso for Linux (Enterprise Edition)</a>
   </div>
   <div>
      <a href="unxinstvirt.html">Virtuoso for Unix (Enterprise Edition)</a>
   </div>
   <div>
      <a href="unixpersonainstall.html">Virtuoso for Unix (Personal Edition)</a>
   </div>
   <div>
      <a href="installmacosx.html">Virtuoso for Mac OS X</a>
   </div>
   <div>
      <a href="installvsgrid.html">Virtuoso ADO.Net Data Grid Form Application</a>
   </div>
   <div>
      <a href="installvsent.html">Using Visual Studio 2008 to Build an Entity Frameworks based Windows Form Application</a>
   </div>
   <div>
      <a href="installusado.html">Using Visual Studio 2008 to Build an ADO.NET Data Services based Application</a>
   </div>
   <div>
      <a href="installwfas.html">Windows Form Application for accessing Virtuoso RDF data via SPASQL using the Virtuoso ADO.Net Provider</a>
   </div>
   <div>
      <a href="installcrweb.html">Creating a Web Browser Application to Access RDF Data Using The Virtuoso ADO.Net Provider</a>
   </div>
   <div>
      <a href="installsilver.html">Creating a Silverlight Application to consume the service</a>
   </div>
   <div>
      <a href="installnetriadd.html">Creating A Simple .NET RIA Services Application To Display Data
From Virtuoso</a>
   </div>
   <div class="selected">
      <a href="installnetriavd.html">Creating a .Net RIA Services Application That Will Update Virtuoso Data</a>
    <div>
        <a href="#installnetriavdpreq" title="Pre-requisites">Pre-requisites</a>
        <a href="#installnetriavdcrser" title="Creating the Application">Creating the Application</a>
        <a href="#installnetriavdcrprup" title="Propagate Updates to Virtuoso">Propagate Updates to Virtuoso</a>
    </div>
   </div>
   <div>
      <a href="clusterstcnf.html">Cluster Installation and Config</a>
   </div>
    <br />
  </div>
  <div id="text">
    <a name="installnetriavd" />
    <h2>2.13. Creating a .Net RIA Services Application That Will Update Virtuoso Data</h2>
<p>This example demonstrates how data in Virtuoso can be updated from a Microsoft .NET RIA Services
application. The example is a continuation of the first example in <a href="installnetriadd.html">Creating a Simple .Net RIA Services
Application to Display Data From Virtuoso</a>.</p>
      
        <a name="installnetriavdpreq" />
    <h3>2.13.1. Pre-requisites</h3>
<ol>
      <li>A working copy of the application created in <a href="installnetriadd.html">Creating a
Simple .Net RIA Services Application to Display Data From Virtuoso</a>.</li>
    </ol>
    <br />
    
        <a name="installnetriavdcrser" />
    <h3>2.13.2. Creating the Application</h3>
<p>
      <strong>Step 1 - Add A New Domain Service Class</strong>
    </p>
<p>The EmployeeService Domain Service Class was only used to display data so was created
read only. In this example we need to be able to update the data so we need to remove the read
only Domain Service Class and create a new on.</p>
<ol>
    <li>In the <strong>Server Explorer</strong> right click EmployeeService and select <strong>Delete</strong>
    </li>
      <li>Right click the server project and <strong>Add New Item</strong>. In the dialog box choose Domain Service Class from the Templates pane and again call it EmployeeService.cs. Click Add.</li>
      <li>Select the Employees entity and tick <strong>Enable editing</strong>. Also tick <strong>Generated associated classes for metadata</strong>.
      <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt=".NET RIA Services Application" src="../images/ui/riad1.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.13.2.1. .NET RIA Services Application</td>
      </tr>
        </table>
  </li>
      <li>Update MainPage.xaml.cs to use EmployeeService2 the new domain service rather than EmployeeContext.</li>
    </ol>
  <p>We want to create a master detail style page. To do this we will use the DomainDataSourceComponent
from the Silverlight Components. But first we will add a pager so only 5 records are displayed at a time.</p>
<p>
      <strong>Step 2 - Add a DataPager</strong>
    </p>
<ol>
      <li>Add two new namespaces to MainPage.xaml
<div>
          <pre class="programlisting">
xmlns:riaControls=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Ria.Controls&quot;
xmlns:ds=&quot;clr-namespace:DemoApplication.Web&quot;
</pre>
        </div>
  </li>
      <li>Use a DomainDataSource to provide the data to fill the grid. Add the following to
MainPage.xaml before the DataGrid.
<div>
          <pre class="programlisting">
&lt;riaControls:DomainDataSource x:Name=&quot;EmployeeDataSource&quot;
                              QueryName=&quot;GetEmployeesQuery&quot;
                              LoadSize=&quot;10&quot;
                              AutoLoad=&quot;True&quot;&gt;
    &lt;riaControls:DomainDataSource.DomainContext&gt;
        &lt;ds:EmployeeService2/&gt;
    &lt;/riaControls:DomainDataSource.DomainContext&gt;
&lt;/riaControls:DomainDataSource&gt;
</pre>
        </div>
  </li>
      <li>Update the MainPage.xaml.cs code behind file. Using the DomainDataSource means you no
longer need to instantiate the context and load the grid in MainPage.xaml.cs so it becomes:
<div>
          <pre class="programlisting">
public partial class MainPage : UserControl
{
    public MainPage()
    {
        InitializeComponent();
    }
}
</pre>
        </div>
  </li>
      <li>Set the binding source of the DataGrid to the DomainDataSource
<div>
          <pre class="programlisting">
&lt;data:DataGrid MinHeight=&quot;100&quot;  IsReadOnly=&quot;True&quot; ItemsSource=&quot;{Binding Data, ElementName=EmployeeDataSource}&quot; x:Name=&quot;DataGrid1&quot;&gt;&lt;/data:DataGrid&gt; /&gt;
</pre>
        </div>
  </li>
      <li>Drag a DataPager form the tool box onto MainPage.xaml just after the DataGrid.
  </li>
      <li>Add a page size and binding element to the DataPager.
<div>
          <pre class="programlisting">
&lt;data:DataPager PageSize=&quot;5&quot; Source=&quot;{Binding Data, ElementName=employeeDataSource}&quot;
                      Margin=&quot;0,-1,0,0&quot;&gt;&lt;/data:DataPager&gt;
</pre>
        </div>
  </li>
      <li>Build and run the application. The data should be displayed 5 rows at a time.
      <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt=".NET RIA Services Application" src="../images/ui/riad2.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.13.2.1. .NET RIA Services Application</td>
      </tr>
        </table>
  </li>
    </ol>
  <p>We now need to add a DataForm to display the details.</p>
<p>
      <strong>Step 3 - Add a DataForm</strong>
    </p>
<ol>
      <li>Add the following namespace to MainPage.xaml
<div>
          <pre class="programlisting">
xmlns:dataForm=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.DataForm.Toolkit&quot;
</pre>
        </div>
</li>
      <li>Add the form to MainPage.xaml
<div>
          <pre class="programlisting">
&lt;dataForm:DataForm x:Name=&quot;dataForm1&quot; Header=&quot;Employee Information&quot;  AutoGenerateFields=&quot;False&quot; AutoEdit=&quot;False&quot; AutoCommit=&quot;False&quot; CurrentItem=&quot;{Binding SelectedItem, ElementName=DataGrid1}&quot; Margin=&quot;0,12,0,0&quot;&gt;
   &lt;dataForm:DataForm.EditTemplate&gt;
       &lt;DataTemplate&gt;
           &lt;StackPanel&gt;
               &lt;dataForm:DataField Label=&quot;Employee ID&quot;&gt;
                   &lt;TextBox Text=&quot;{Binding EmployeeID, Mode=TwoWay}&quot; /&gt;
               &lt;/dataForm:DataField&gt;
               &lt;dataForm:DataField Label=&quot;First Name&quot;&gt;
                   &lt;TextBox Text=&quot;{Binding FirstName, Mode=TwoWay}&quot; /&gt;
               &lt;/dataForm:DataField&gt;
               &lt;dataForm:DataField Label=&quot;Last Name&quot;&gt;
                   &lt;TextBox Text=&quot;{Binding LastName, Mode=TwoWay}&quot; /&gt;
               &lt;/dataForm:DataField&gt;
               &lt;dataForm:DataField Label=&quot;Courtesy Title&quot;&gt;
                   &lt;TextBox Text=&quot;{Binding TitleOfCourtesy, Mode=TwoWay}&quot; /&gt;
               &lt;/dataForm:DataField&gt;
               &lt;dataForm:DataField Label=&quot;Hire Date&quot;&gt;
                   &lt;TextBox Text=&quot;{Binding HireDate, Mode=TwoWay}&quot; /&gt;
               &lt;/dataForm:DataField&gt;
               &lt;dataForm:DataField Label=&quot;Title&quot;&gt;
                   &lt;TextBox Text=&quot;{Binding Title, Mode=TwoWay}&quot;  /&gt;
               &lt;/dataForm:DataField&gt;
               &lt;dataForm:DataField Label=&quot;Reports To&quot;&gt;
                   &lt;TextBox Text=&quot;{Binding ReportsTo, Mode=TwoWay}&quot;  /&gt;
               &lt;/dataForm:DataField&gt;
               &lt;dataForm:DataField Label=&quot;Region&quot;&gt;
                   &lt;TextBox Text=&quot;{Binding Region, Mode=TwoWay}&quot;  /&gt;
               &lt;/dataForm:DataField&gt;
               &lt;dataForm:DataField Label=&quot;Address&quot;&gt;
                   &lt;TextBox Text=&quot;{Binding Address, Mode=TwoWay}&quot;  /&gt;
               &lt;/dataForm:DataField&gt;
               &lt;dataForm:DataField Label=&quot;City&quot;&gt;
                   &lt;TextBox Text=&quot;{Binding City, Mode=TwoWay}&quot;  /&gt;
               &lt;/dataForm:DataField&gt;
               &lt;dataForm:DataField Label=&quot;Country Code&quot;&gt;
                   &lt;TextBox Text=&quot;{Binding CountryCode, Mode=TwoWay}&quot;  /&gt;
               &lt;/dataForm:DataField&gt;
               &lt;dataForm:DataField Label=&quot;Postal Code&quot;&gt;
                   &lt;TextBox Text=&quot;{Binding PostalCode, Mode=TwoWay}&quot;  /&gt;
               &lt;/dataForm:DataField&gt;
                   &lt;/StackPanel&gt;
       &lt;/DataTemplate&gt;
   &lt;/dataForm:DataForm.EditTemplate&gt;
 &lt;/dataForm:DataForm&gt;
</pre>
        </div>
</li>
      <li>Surround the DomainDataSource, DataGrid and DataForm with
<div>
          <pre class="programlisting">
        &lt;ScrollViewer BorderThickness=&quot;0&quot;  VerticalScrollBarVisibility=&quot;Auto&quot; Padding=&quot;12,0,12,0&quot; Margin=&quot;-2&quot;&gt;
            &lt;StackPanel Margin=&quot;0,12,0,12&quot; Orientation=&quot;Vertical&quot; &gt;
.
.
.
            &lt;/StackPanel&gt;
        &lt;/ScrollViewer&gt;
</pre>
        </div>
</li>
      <li>Build and run the application. As each employee is selected the data form fill with their details
      <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt=".NET RIA Services Application" src="../images/ui/riad3.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.13.2.1. .NET RIA Services Application</td>
      </tr>
        </table>
</li>
    </ol>
<p>By clicking on the pencil symbol in the top right hand corner the data in the form can be edited
but it is not propagated back to the database.</p>
   <br />
    
        <a name="installnetriavdcrprup" />
    <h3>2.13.3. Propagate Updates to Virtuoso</h3>
<ol>
      <li>Add a &#39;Submit&#39; button just after the DataForm in MainPage.xaml by adding the following code.
<div>
          <pre class="programlisting">
&lt;StackPanel Orientation=&quot;Horizontal&quot; HorizontalAlignment=&quot;Right&quot; Margin=&quot;0,12,0,0&quot;&gt;
  &lt;Button x:Name=&quot;submitButton&quot; Width=&quot;75&quot; Height=&quot;23&quot;  Content=&quot;Submit&quot;  Margin=&quot;4,0,0,0&quot; Click=&quot;submitButton_Click&quot;/&gt;
&lt;/StackPanel&gt;
</pre>
        </div>
</li>
      <li>Handle the button click event in MainPage.xaml.cs by adding the following code:
<div>
          <pre class="programlisting">
private void submitButton_Click(object sender, RoutedEventArgs e)
        {
            EmployeeDataSource.SubmitChanges();
        }
</pre>
        </div>
</li>
      <li>Build and run the application. If you now edit data in the form and click the submit button
the data in Virtuoso will be updated.
      <table class="figure" border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td>
              <img alt=".NET RIA Services Application" src="../images/ui/riad4.png" />
       </td>
      </tr>
      <tr>
            <td>Figure: 2.13.3.1. .NET RIA Services Application</td>
      </tr>
        </table>
</li>
    </ol>
   <br />
<table border="0" width="90%" id="navbarbottom">
    <tr>
        <td align="left" width="33%">
          <a href="installnetriadd.html" title="Creating A Simple .NET RIA Services Application To Display Data&#10;From Virtuoso">Previous</a>
          <br />Creating A Simple .NET RIA Services Application To Display Data
From Virtuoso</td>
     <td align="center" width="34%">
          <a href="installation.html">Chapter Contents</a>
     </td>
        <td align="right" width="33%">
          <a href="clusterstcnf.html" title="Cluster Installation and Config">Next</a>
          <br />Cluster Installation and Config</td>
    </tr>
    </table>
  </div>
  <div id="footer">
    <div>Copyright© 1999 - 2009 OpenLink Software All rights reserved.</div>
   <div id="validation">
    <a href="http://validator.w3.org/check/referer">
        <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" />
    </a>
    <a href="http://jigsaw.w3.org/css-validator/">
        <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" height="31" width="88" />
    </a>
   </div>
  </div>
 </body>
</html>