Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've cracked it. My Inheriting class has now become the following:</p> <pre><code>public abstract class CustomerProvider : PositionProvider&lt;CustomerEntity&gt; { public CustomerProvider() { } public new static CustomerProvider Instance { get { if (_instance == null) { DalHelper.CreateInstance&lt;CustomerProvider&gt;(out _instance); } return _instance; } } private static CustomerProvider _instance; public override List&lt;CustomerEntity&gt; GetList() { return PositionProvider&lt;CustomerEntity&gt;.Instance.GetList(); } public abstract List&lt;CustomerEntity&gt; GetCustomersByUserPermission(Guid userId); } </code></pre> <p>It has a concrete implementation as follows:</p> <pre><code>public class SqlCustomerProvider : CustomerProvider { public override List&lt;CustomerEntity&gt; GetCustomersByUserPermission(Guid userId) { using (SqlConnection cn = new SqlConnection(Globals.Instance.ConnectionString)) { SqlCommand cmd = new SqlCommand("GetRP_CustomersByUser", cn); cmd.Parameters.Add("@UserId", SqlDbType.UniqueIdentifier).Value = userId; cmd.CommandType = CommandType.StoredProcedure; cn.Open(); return this.GetCollectionFromReader(this.ExecuteReader(cmd)); } } } </code></pre> <p>My PositionProvider remains the same, but by calling it in the overrides in the extending CustomerProvider, it then uses the SqlPositionProvider for the provider specific code.</p> <p>I can now achieve what I wanted.</p> <pre><code>// Returns a list of customers still using the PositionProvider CustomerProvider.Instance.GetList(); // Returns my specific customer data CustomerProvider.Instance.GetCustomersByUserPermission(); // Returns a list of sites still using the PositionProvider SiteProvider.Instance.GetList(); // Not part of the SiteProvider! SiteProvider.Instance.GetCustomersByUserPermission(); </code></pre>
 

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