Source

Camino / src / Empi.Camino / Data / RepositoryFactory.cs

Full commit
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Empi.Camino.Data
{
    /// <summary>
    /// Builds the Repositories for Access to the Different Databases
    /// </summary>
    internal static class RepositoryFactory
    {
        //private static T GetRepository<T, V>()
        //    where T : RepositoryBase<V>
        //    where V : class
        //{
        //    return null;



        //}

        /// <summary>
        /// Gets a meta data repository.
        /// </summary>
        /// <typeparam name="TEntity">The type of the entity.</typeparam>
        /// <returns>Returns a repository instance ready for calling against it.</returns>
        internal static RepositoryBase<TEntity> GetMetaDataRepository<TEntity>() where TEntity : class
        {
            return new Meta.MetaDataRepository<TEntity>();
        }

        /// <summary>
        /// Gets a cached meta data repository.
        /// </summary>
        /// <typeparam name="TEntity">The type of the entity.</typeparam>
        /// <returns>Returns a repository instance ready for calling against it.</returns>
        internal static RepositoryBase<TEntity> GetCachedMetaDataRepository<TEntity>() where TEntity : class
        {
            return GetMetaDataRepository<TEntity>();
        }


        /// <summary>
        /// Gets a retailer data repository.
        /// </summary>
        /// <typeparam name="TEntity">The type of the entity.</typeparam>
        /// <returns>Returns a repository instance ready for calling against it.</returns>
        internal static RepositoryBase<TEntity> GetRetailerDataRepository<TEntity>() where TEntity : class
        {
            return new Retailer.RetailerDataRepository<TEntity>();
        }

        /// <summary>
        /// Gets a cached retailer data repository.
        /// </summary>
        /// <typeparam name="TEntity">The type of the entity.</typeparam>
        /// <returns>Returns a repository instance ready for calling against it.</returns>
        internal static RepositoryBase<TEntity> GetCachedRetailerDataRepository<TEntity>() where TEntity : class
        {
            return GetRetailerDataRepository<TEntity>();
        }
    }

}