Files
itca_api_sap_wms/Net.Connection/RepositoryBase/RepositoryBase.cs
T

43 lines
1.3 KiB
C#
Raw Normal View History

using System.Collections.Generic;
namespace Net.Connection
{
public abstract class RepositoryBase<T> : IRepositoryBase<T> where T : class
{
protected IConnectionSQL context { get; set; }
public RepositoryBase(IConnectionSQL context)
{
this.context = context;
}
public IEnumerable<T> FindAll(T entity, string storeProcedure)
{
return context.ExecuteSqlViewAll<T>(storeProcedure, entity);
}
public IEnumerable<T> FindByCondition(object entity, string storeProcedure)
{
return context.ExecuteSqlViewFindByCondition<T>(storeProcedure, entity);
}
public T FindById(object entity, string storeProcedure)
{
return context.ExecuteSqlViewId<T>(storeProcedure, entity);
}
public int Create(object entity, string storeProcedure)
{
return (int)context.ExecuteSqlInsert<T>(storeProcedure, entity);
}
public void Delete(T entity, string storeProcedure)
{
context.ExecuteSqlDelete<T>(storeProcedure, entity);
}
public void Update(object entity, string storeProcedure)
{
this.context.ExecuteSqlUpdate<T>(storeProcedure, entity);
}
}
}