progress on data access manager
This commit is contained in:
parent
5151da0724
commit
3a6ca75196
20
COA.EnterpriseServices.DataAccess/DataAccessManager.cs
Normal file
20
COA.EnterpriseServices.DataAccess/DataAccessManager.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace COA.EnterpriseServices.DataAccess
|
||||||
|
{
|
||||||
|
public static class DataAccessManager
|
||||||
|
{
|
||||||
|
private static readonly IDictionary<Type, ;
|
||||||
|
|
||||||
|
public static ICollection<IDataAccess<T>> GetDataAccess<T>() where T : class, IRecord
|
||||||
|
{
|
||||||
|
return Dependencies.Container
|
||||||
|
.GetAllInstances<IDataAccess<T>>()
|
||||||
|
.OrderBy(i => i.GetType().Name.StartsWith("QuickBase", StringComparison.OrdinalIgnoreCase))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,14 +6,11 @@ namespace COA.EnterpriseServices.DataAccess.Helpers
|
|||||||
{
|
{
|
||||||
public class BaseHelper<T> where T : class, IRecord
|
public class BaseHelper<T> where T : class, IRecord
|
||||||
{
|
{
|
||||||
protected readonly ICollection<IDataAccess<T>> dataAccessInstances;
|
private readonly ICollection<IDataAccess<T>> dataAccessInstances;
|
||||||
|
|
||||||
public BaseHelper()
|
public BaseHelper()
|
||||||
{
|
{
|
||||||
dataAccessInstances = Dependencies.Container
|
dataAccessInstances = DataAccessManager.GetDataAccess<T>();
|
||||||
.GetAllInstances<IDataAccess<T>>()
|
|
||||||
.OrderBy(i => i.GetType().Name.StartsWith("QuickBase", StringComparison.OrdinalIgnoreCase))
|
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected TResult Invoke<TResult>(Func<IDataAccess<T>, TResult> func)
|
protected TResult Invoke<TResult>(Func<IDataAccess<T>, TResult> func)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user