Here's what I came up with:

/// <summary>
///
/// </summary>
/// <typeparam name="T"></typeparam>
interface IEntityProvider<T> where T: BaseEntity {
  /// <summary>
  /// Gets the specified id.
  /// </summary>
  /// <param name="id">The id.</param>
  /// <returns></returns>
  T Get(int id);
  /// <summary>
  /// Gets all.
  /// </summary>
  /// <returns></returns>
  List<T> GetAll();
}

/// <summary>
///
/// </summary>
interface IUserProvider : IEntityProvider(User) {
  /// <summary>
  /// Finds the name of the by last.
  /// </summary>
  /// <param name="lastName">Name of the last.</param>
  /// <returns></returns>
  User FindByLastName(string lastName);
}

/// <summary>
///
/// </summary>
/// <typeparam name="I"></typeparam>
/// <typeparam name="T"></typeparam>
class ProviderFactory<I, T>
                where I: IEntityProvider<T>
                where T: BaseEntity
{
  /// <summary>
  /// Creates the provider.
  /// </summary>
  /// <returns></returns>
  public static I CreateProvider(){}
}

// Create the Provider
IUserProvider x = ProviderFactory<IUserProvider, User>.CreateProvider();

// Find the User
User y = x.FindBy...

// Get all the users
User[] yy = x.GetAll().ToArray();

Mostly these comments were created by GhostDoc [1], but some were added by
hand...

Thanks,

Shawn Wildermuth
http://adoguy.com
http://wildermuthconsulting.com
Microsoft MVP (C#), MCSD.NET, Author and Speaker

[1] http://www.roland-weigelt.de/ghostdoc/

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to