COA.EnterpriseServices/COA.EnterpriseServices.DataAccess/IDataAccess.cs

39 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq.Expressions;
namespace COA.EnterpriseServices.DataAccess
{
public interface IDataAccess<T> where T : class, IRecord
{
/// <summary>
/// Adds an item of type <typeparamref name="T"/> to the context
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
bool Add(T item);
/// <summary>
/// Updates an item of type <typeparamref name="T"/> in the context
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
bool Update(T item);
/// <summary>
/// Gets an item collection of type <typeparamref name="T"/> from the context
/// </summary>
/// <param name="query"></param>
/// <returns></returns>
ICollection<T> Get(Expression<Func<T, bool>> query);
/// <summary>
/// Allows support for invoking a raw command if supported by the instance
/// </summary>
/// <param name="command"></param>
/// <param name="parameters"></param>
/// <returns></returns>
ICollection<T> Raw(string command, params object[] parameters);
}
}