Created
August 3, 2016 01:56
-
-
Save Frannsoft/53b854cb204ef836efdc709ec1a5e917 to your computer and use it in GitHub Desktop.
IMetadata Service interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IMetadataService | |
{ | |
/// <summary> | |
/// Join on Entity Id instead of MoveId. If you want to join on MoveId use GetWithMoves. | |
/// </summary> | |
/// <typeparam name="TEntity"></typeparam> | |
/// <typeparam name="TDto"></typeparam> | |
/// <param name="id"></param> | |
/// <param name="fields"></param> | |
/// <returns></returns> | |
dynamic GetWithMovesOnEntity<TEntity, TDto>(int id, string fields = "") | |
where TEntity : class, IMoveIdEntity | |
where TDto : class; | |
/// <summary> | |
/// Joins with the moves table to get back all of type <typeparamref name="TEntity"/> | |
/// with a matching MoveId. | |
/// </summary> | |
/// <typeparam name="TEntity"></typeparam> | |
/// <typeparam name="TDto"></typeparam> | |
/// <param name="id"></param> | |
/// <param name="fields"></param> | |
/// <returns></returns> | |
dynamic GetWithMoves<TEntity, TDto>(int id, string fields = "") | |
where TEntity : class, IMoveIdEntity | |
where TDto : class; | |
/// <summary> | |
/// Forms an return value from a previously found entity. | |
/// </summary> | |
/// <typeparam name="TEntity"></typeparam> | |
/// <typeparam name="TDto"></typeparam> | |
/// <param name="entity"></param> | |
/// <param name="fields"></param> | |
/// <returns></returns> | |
dynamic GetFromEntity<TEntity, TDto>(TEntity entity, string fields = "") | |
where TEntity : class, IMoveIdEntity | |
where TDto : class; | |
/// <summary> | |
/// Get all of type <typeparamref name="TEntity"/>. Joins with moves table | |
/// and brings back matching MoveId values. | |
/// </summary> | |
/// <typeparam name="TEntity"></typeparam> | |
/// <typeparam name="TDto"></typeparam> | |
/// <param name="fields"></param> | |
/// <returns></returns> | |
IEnumerable<dynamic> GetAllWithMoves<TEntity, TDto>(string fields = "") | |
where TEntity : class, IMoveIdEntity | |
where TDto : class; | |
/// <summary> | |
/// Get all entities of type <typeparamref name="TPrimaryEntity"/> that have <typeparamref name="id"/> | |
/// of the specified value of type <typeparamref name="TJoinEntity"/>. | |
/// </summary> | |
/// <typeparam name="TJoinEntity"></typeparam> | |
/// <typeparam name="TPrimaryEntity"></typeparam> | |
/// <typeparam name="TDto"></typeparam> | |
/// <param name="id"></param> | |
/// <param name="fields"></param> | |
/// <returns></returns> | |
IEnumerable<dynamic> GetAllForOwnerId<TJoinEntity, TPrimaryEntity, TDto>(int id, string fields = "") | |
where TJoinEntity : class, IMoveEntity | |
where TPrimaryEntity : class, IMoveIdEntity | |
where TDto : class; | |
/// <summary> | |
/// Get a single entity. | |
/// </summary> | |
/// <param name="id"></param> | |
/// <param name="fields"></param> | |
/// <returns></returns> | |
dynamic Get<TEntity, TDto>(int id, string fields = "") | |
where TEntity : class, IEntity | |
where TDto : class; | |
/// <summary> | |
/// Get an entity where the expression is true. | |
/// </summary> | |
/// <typeparam name="TEntity"></typeparam> | |
/// <typeparam name="TDto"></typeparam> | |
/// <param name="where"></param> | |
/// <param name="fields"></param> | |
/// <returns></returns> | |
dynamic Get<TEntity, TDto>(Expression<Func<TEntity, bool>> where, string fields = "") | |
where TEntity : class, IEntity | |
where TDto : class; | |
/// <summary> | |
/// Get fields of the specified entities where the expression is true. | |
/// </summary> | |
/// <typeparam name="TEntity"></typeparam> | |
/// <typeparam name="TDto"></typeparam> | |
/// <param name="where"></param> | |
/// <param name="fields"></param> | |
/// <returns></returns> | |
IEnumerable<dynamic> GetAll<TEntity, TDto>(Expression<Func<TEntity, bool>> where, string fields = "") | |
where TEntity : class, IEntity | |
where TDto : class; | |
/// <summary> | |
/// Get all entity data of a specific type. | |
/// </summary> | |
/// <param name="fields"></param> | |
/// <returns></returns> | |
IEnumerable<dynamic> GetAll<TEntity, TDto>(string fields = "") | |
where TEntity : class, IEntity | |
where TDto : class; | |
/// <summary> | |
/// Update an existing entity. | |
/// </summary> | |
/// <param name="id"></param> | |
/// <param name="dto"></param> | |
void Update<TEntity, TDto>(int id, TDto dto) | |
where TEntity : class, IEntity | |
where TDto : class; | |
/// <summary> | |
/// Add an entity. | |
/// </summary> | |
/// <param name="dto"></param> | |
/// <returns></returns> | |
TDto Add<TEntity, TDto>(TDto dto) | |
where TEntity : class, IEntity | |
where TDto : class; | |
/// <summary> | |
/// Delete an entity. | |
/// </summary> | |
/// <param name="id"></param> | |
void Delete<T>(int id) | |
where T : class, IEntity; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment