Note that there are some explanatory texts on larger screens.

plurals
  1. PONot the right <type>?
    text
    copied!<p>I'm confused. I've got a Silverlight project that currently runs and displays a list of servers from my mocked model (I am following the MVVM pattern).</p> <p>The interface is coded as follows:</p> <pre><code>public class GetServersCompletedEventArgs : EventArgs { public Exception Error {get; set;} public IEnumerable&lt;LicenseServer&gt; Results {get; private set;} public GetServersCompletedEventArgs(Exception error, IEnumerable&lt;LicenseServer&gt; results) { this.Error = error; this.Results = results; } } public delegate void GetServersCompletedEvent(GetServersCompletedEventArgs e); public interface IDataService { void GetServers(); event GetServersCompletedEvent GetServersCompleted; } </code></pre> <p>As you can see the CompletedEventArgs return the results as a IEnumerable. </p> <p>The problem that I am having is defining <code>&lt;LicenseServer&gt;</code> in such a way that I can stub it with fake data or populate the results from real data (ala ado.net data services).</p> <p>I've created a local class LicenseServer but the service always returns a different type of LicenseServer. </p> <p>I get an error:</p> <blockquote> <p>convert Unable to cast object of type 'DataServiceOrderedQuery[LicenseMon.LMonServiceReference.License_Server]' to type 'System.Data.Services.Client.DataServiceQuery`1[LicenseMon.Model.LicenseServer]</p> </blockquote> <p>Which I read as LicenseServer from the service reference cannot be converted over to the LicenseServer I've defined in my model class</p> <p>Why am I having trouble? Shouldn't I be able to develop my classes independently and be able to switch between a live database and my internally generated data? Am I approaching this the wrong way?</p> <p>Any code samples, explanations, links etc would be most helpful</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload