Last active
July 19, 2017 04:38
-
-
Save bklooste/72ac65860dd20cc4a96d3348b027f68b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System.Threading.Tasks; | |
using Cosmos.Common.Contracts; | |
using System; | |
// fixme | |
namespace Cosmos.Services | |
{ | |
public interface ICrudGetService<T> : ICosmosService where T : IHasId, IIsModifyable | |
{ | |
// get | |
Task<long> Count(); //200 | |
Task<T> Get(Guid id , bool includeDeleted = false); //200 , 404 | |
Task<Guid[]> GetAllIds(); //200 , 404 | |
Task<T[]> GetAll(bool includeDeleted = false); //200 , 404 | |
Task<T[]> GetAll(Guid[] ids); //200 , 404 | |
Task<NameValue[]> GetAllNames(); //200 , 404 | |
Task Delete(Guid id); //200 , 404 | |
} | |
public interface ICrudPostService<T> : ICosmosService where T : IHasId//, IIsModifyable | |
{ | |
////post we skip the mosts | |
Task AddOrUpdate(T record); // 204 , 400 | |
Task AddOrUpdateMany(T[] records); // 204 , 400 | |
} | |
// we may need more than T[] but that could be a different method. | |
public interface IVersionedService<T> : ICosmosService where T : IHasVer | |
{ | |
Task<T[]> GetByVer(long position , int maxCount); //200 , 404 | |
} | |
// while simpler to use this contract will expose some extra fields that are ignored | |
public interface ICrudService<T> : ICrudGetService<T> , ICrudPostService<T> where T : IHasId , IIsModifyable | |
{ | |
} | |
} |
Should arrays be replaced with IEnumerable ? I think so... the reason for arrays is serialisation behaviour but most serializers are pretty good these days in terms of mapping collections to arrays.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Aaron Wyatt suggest getting a list of names as objects could be deep HDS. I have added returning NameValue..