# C1.Win.Data.Entities.C1DataSource

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="C1_Win_Data_Entities_C1DataSource" data-uid="C1.Win.Data.Entities.C1DataSource" class="text-break">C1DataSource Class
</h1>
  <div class="markdown level0 summary"><p>A data source control that simplifies data binding of GUI controls
to data in a <a class="xref" href="../C1.Data.Entity.4.8/C1.Data.Entities.EntityClientCache.html">EntityClientCache</a>. Can be used to bind multiple controls to different queries.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
    <div class="level1"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.marshalbyrefobject">MarshalByRefObject</a></div>
    <div class="level2"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.component">Component</a></div>
    <div class="level3"><span class="xref">C1DataSource</span></div>
  </div>
  <div class="implements">
    <h5>Implements</h5>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.icomponent">IComponent</a></div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.idisposable">IDisposable</a></div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.isupportinitialize">ISupportInitialize</a></div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.ilistsource">IListSource</a></div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.iextenderprovider">IExtenderProvider</a></div>
    <div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.componentmodel.inotifypropertychanged">INotifyPropertyChanged</a></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="C1.Win.Data.Entities.html">C1.Win.Data.Entities</a></h6>
  <h6><strong>Assembly</strong>: C1.Win.Data.Entity.4.8.dll</h6>
  <h5 id="C1_Win_Data_Entities_C1DataSource_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">[ToolboxBitmap(typeof(C1DataSource), &quot;C1DataSource.png&quot;)]
public class C1DataSource : Component, IComponent, IDisposable, ISupportInitialize, IListSource, IExtenderProvider, INotifyPropertyChanged</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">&lt;ToolboxBitmap(GetType(C1DataSource), &quot;C1DataSource.png&quot;)&gt;
Public Class C1DataSource
    Inherits Component
    Implements IComponent, IDisposable, ISupportInitialize, IListSource, IExtenderProvider, INotifyPropertyChanged</code></pre>
  </div>
  <h5 id="C1_Win_Data_Entities_C1DataSource_remarks"><strong>Remarks</strong></h5>
  <div class="markdown level0 remarks"><p>To bind a control to data in an <a class="xref" href="../C1.Data.Entity.4.8/C1.Data.Entities.EntityClientCache.html">EntityClientCache</a>,
put a <a class="xref" href="C1.Win.Data.Entities.C1DataSource.html">C1DataSource</a> on your form,
specify the <a class="xref" href="C1.Win.Data.Entities.C1DataSource.ContextType.html#C1_Win_Data_Entities_C1DataSource_ContextType">context type</a>,
populate the <a class="xref" href="C1.Win.Data.Entities.C1DataSource.ViewSources.html#C1_Win_Data_Entities_C1DataSource_ViewSources">ViewSources</a> collection with <a class="xref" href="../C1.Data.Entity.4.8/C1.Data.Entities.EntityViewSource.html">EntityViewSource</a> objects to define views (based on queries),
and bind the GUI control to the <a class="xref" href="C1.Win.Data.Entities.C1DataSource.html">C1DataSource</a> by setting the GUI control's DataSource and DataMember properties.</p>
</div>
  <h3 id="constructors">Constructors
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource__ctor" data-uid="C1.Win.Data.Entities.C1DataSource.#ctor">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.-ctor.html#C1_Win_Data_Entities_C1DataSource__ctor">C1DataSource()</a>
        </td>
        <td class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="C1.Win.Data.Entities.C1DataSource.html">C1DataSource</a> class.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="properties">Properties
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_ClientCache" data-uid="C1.Win.Data.Entities.C1DataSource.ClientCache">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.ClientCache.html#C1_Win_Data_Entities_C1DataSource_ClientCache">ClientCache</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the <a class="xref" href="../C1.Data.Entity.4.8/C1.Data.Entities.EntityClientCache.html">EntityClientCache</a> used by this <a class="xref" href="C1.Win.Data.Entities.C1DataSource.html">C1DataSource</a> to access the data.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_ClientScope" data-uid="C1.Win.Data.Entities.C1DataSource.ClientScope">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.ClientScope.html#C1_Win_Data_Entities_C1DataSource_ClientScope">ClientScope</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the <a class="xref" href="../C1.Data.Entity.4.8/C1.Data.Entities.EntityClientScope.html">client scope</a> to which this <a class="xref" href="C1.Win.Data.Entities.C1DataSource.html">C1DataSource</a> belongs.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_ContextType" data-uid="C1.Win.Data.Entities.C1DataSource.ContextType">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.ContextType.html#C1_Win_Data_Entities_C1DataSource_ContextType">ContextType</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the type of a <span class="xref">System.Data.Entity.DbContext</span> or an <span class="xref">System.Data.Objects.ObjectContext</span>
used to obtain the <a class="xref" href="../C1.Data.Entity.4.8/C1.Data.Entities.EntityClientCache.GetDefault.html#C1_Data_Entities_EntityClientCache_GetDefault_System_Type_">default client cache</a>.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_DbContext" data-uid="C1.Win.Data.Entities.C1DataSource.DbContext">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.DbContext.html#C1_Win_Data_Entities_C1DataSource_DbContext">DbContext</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the <span class="xref">System.Data.Entity.DbContext</span> the <a class="xref" href="C1.Win.Data.Entities.C1DataSource.ClientCache.html#C1_Win_Data_Entities_C1DataSource_ClientCache">ClientCache</a> is connected to.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_Item_System_Int32_" data-uid="C1.Win.Data.Entities.C1DataSource.Item(System.Int32)">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.Item.html#C1_Win_Data_Entities_C1DataSource_Item_System_Int32_">this[int]</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the <a class="xref" href="../C1.Data.Entity.4.8/C1.Data.DataSource.ClientCollectionView.html">ClientCollectionView</a> of the <a class="xref" href="../C1.Data.Entity.4.8/C1.Data.Entities.EntityViewSource.html">EntityViewSource</a>
at the specified <code class="paramref">index</code> in the <a class="xref" href="C1.Win.Data.Entities.C1DataSource.ViewSources.html#C1_Win_Data_Entities_C1DataSource_ViewSources">ViewSources</a> collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_Item_System_String_" data-uid="C1.Win.Data.Entities.C1DataSource.Item(System.String)">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.Item.html#C1_Win_Data_Entities_C1DataSource_Item_System_String_">this[string]</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the <a class="xref" href="../C1.Data.Entity.4.8/C1.Data.DataSource.ClientCollectionView.html">ClientCollectionView</a> of the <a class="xref" href="../C1.Data.Entity.4.8/C1.Data.Entities.EntityViewSource.html">EntityViewSource</a> with the specified <code class="paramref">name</code>
in the <a class="xref" href="C1.Win.Data.Entities.C1DataSource.ViewSources.html#C1_Win_Data_Entities_C1DataSource_ViewSources">ViewSources</a> collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_ObjectContext" data-uid="C1.Win.Data.Entities.C1DataSource.ObjectContext">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.ObjectContext.html#C1_Win_Data_Entities_C1DataSource_ObjectContext">ObjectContext</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the <span class="xref">System.Data.Objects.ObjectContext</span> the <a class="xref" href="C1.Win.Data.Entities.C1DataSource.ClientCache.html#C1_Win_Data_Entities_C1DataSource_ClientCache">ClientCache</a> is connected to.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_RefreshInterval" data-uid="C1.Win.Data.Entities.C1DataSource.RefreshInterval">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.RefreshInterval.html#C1_Win_Data_Entities_C1DataSource_RefreshInterval">RefreshInterval</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the interval between automatic <a class="xref" href="C1.Win.Data.Entities.C1DataSource.Refresh.html#C1_Win_Data_Entities_C1DataSource_Refresh">Refresh()</a> operations
to refresh the data with any changes that may have occurred on the server.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_ViewSources" data-uid="C1.Win.Data.Entities.C1DataSource.ViewSources">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.ViewSources.html#C1_Win_Data_Entities_C1DataSource_ViewSources">ViewSources</a>
        </td>
        <td class="markdown level1 summary"><p>Gets a collection of <a class="xref" href="../C1.Data.Entity.4.8/C1.Data.Entities.EntityViewSource.html">EntityViewSource</a> objects that define views (based on queries) in this <a class="xref" href="C1.Win.Data.Entities.C1DataSource.html">C1DataSource</a>.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="methods">Methods
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_BeginInit" data-uid="C1.Win.Data.Entities.C1DataSource.BeginInit">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.BeginInit.html#C1_Win_Data_Entities_C1DataSource_BeginInit">BeginInit()</a>
        </td>
        <td class="markdown level1 summary"></td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_EndInit" data-uid="C1.Win.Data.Entities.C1DataSource.EndInit">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.EndInit.html#C1_Win_Data_Entities_C1DataSource_EndInit">EndInit()</a>
        </td>
        <td class="markdown level1 summary"></td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_GetControlHandler_System_Windows_Forms_Control_" data-uid="C1.Win.Data.Entities.C1DataSource.GetControlHandler(System.Windows.Forms.Control)">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.GetControlHandler.html#C1_Win_Data_Entities_C1DataSource_GetControlHandler_System_Windows_Forms_Control_">GetControlHandler(Control)</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the <a class="xref" href="C1.Win.Data.ControlHandler.html">control handler</a> the specified <code class="paramref">control</code> is currently handled by.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_Load" data-uid="C1.Win.Data.Entities.C1DataSource.Load">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.Load.html#C1_Win_Data_Entities_C1DataSource_Load">Load()</a>
        </td>
        <td class="markdown level1 summary"><p>Loads all <a class="xref" href="../C1.Data.Entity.4.8/C1.Data.Entities.EntityViewSource.html">EntityViewSource</a> objects in the <a class="xref" href="C1.Win.Data.Entities.C1DataSource.ViewSources.html#C1_Win_Data_Entities_C1DataSource_ViewSources">ViewSources</a> collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_Refresh" data-uid="C1.Win.Data.Entities.C1DataSource.Refresh">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.Refresh.html#C1_Win_Data_Entities_C1DataSource_Refresh">Refresh()</a>
        </td>
        <td class="markdown level1 summary"><p>Refreshes all <a class="xref" href="../C1.Data.Entity.4.8/C1.Data.Entities.EntityViewSource.html">EntityViewSource</a> objects in the <a class="xref" href="C1.Win.Data.Entities.C1DataSource.ViewSources.html#C1_Win_Data_Entities_C1DataSource_ViewSources">ViewSources</a> collection.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_RejectChanges" data-uid="C1.Win.Data.Entities.C1DataSource.RejectChanges">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.RejectChanges.html#C1_Win_Data_Entities_C1DataSource_RejectChanges">RejectChanges()</a>
        </td>
        <td class="markdown level1 summary"><p>Rejects the changes for every entity in the context.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_SaveChanges" data-uid="C1.Win.Data.Entities.C1DataSource.SaveChanges">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.SaveChanges.html#C1_Win_Data_Entities_C1DataSource_SaveChanges">SaveChanges()</a>
        </td>
        <td class="markdown level1 summary"><p>Persists all changes to the server.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_SetControlHandler_System_Windows_Forms_Control_C1_Win_Data_ControlHandler_" data-uid="C1.Win.Data.Entities.C1DataSource.SetControlHandler(System.Windows.Forms.Control,C1.Win.Data.ControlHandler)">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.SetControlHandler.html#C1_Win_Data_Entities_C1DataSource_SetControlHandler_System_Windows_Forms_Control_C1_Win_Data_ControlHandler_">SetControlHandler(Control, ControlHandler)</a>
        </td>
        <td class="markdown level1 summary"><p>Connects a <code class="paramref">controlHandler</code> to a given <code class="paramref">control</code>.</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="events">Events
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_SavedChanges" data-uid="C1.Win.Data.Entities.C1DataSource.SavedChanges">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.SavedChanges.html">SavedChanges</a>
        </td>
        <td class="markdown level1 summary"><p>Occurs after a save operation is completed.</p>
</td>
      </tr>
      <tr>
        <td id="C1_Win_Data_Entities_C1DataSource_SavingChanges" data-uid="C1.Win.Data.Entities.C1DataSource.SavingChanges">
          <a class="xref" href="C1.Win.Data.Entities.C1DataSource.SavingChanges.html">SavingChanges</a>
        </td>
        <td class="markdown level1 summary"><p>Occurs before changes are saved.</p>
</td>
      </tr>
    </tbody>
  </table>

</div>
